/** * This method will issue a token for the configured user. * * @return Element The issued element. * @throws LoginException If an error occurs while trying to perform the authentication. */ public Element invokeSTS(final STSClient stsClient) throws WSTrustException { return stsClient.issueToken(endpointURI, tokenType); } }
/** * This method will issue a token for the configured user. * * @return Element The issued element. * @throws LoginException If an error occurs while trying to perform the authentication. */ public Element invokeSTS(final STSClient stsClient) throws WSTrustException { return stsClient.issueToken(endpointURI, tokenType); } }
/** * This method will issue a token for the configured user. * * @return Element The issued element. * * @throws javax.security.auth.login.LoginException If an error occurs while trying to perform the authentication. */ public Element invokeSTS(final STSClient stsClient) throws WSTrustException { return stsClient.issueToken(endpointURI, tokenType); } }
/** * This method will issue a token for the configured user. * * @return Element The issued element. * @throws LoginException If an error occurs while trying to perform the authentication. */ public Element invokeSTS(final STSClient stsClient) throws WSTrustException { return stsClient.issueToken(endpointURI, tokenType); } }
/** * This method will issue a token for the configured user. * * @return Element The issued element. * * @throws javax.security.auth.login.LoginException If an error occurs while trying to perform the authentication. */ public Element invokeSTS(final STSClient stsClient) throws WSTrustException { return stsClient.issueToken(endpointURI, tokenType); } }
/** * <p> * This method issues a token using the specified request and has failover support when more than one endpoint URI has been * provided in the constructor. If a {@code ConnectException} occurs when sending the WS-Trust request to one endpoint, the * code makes a new attempt using the next URI until the request reaches an STS instance or all URIs have been tried. * </p> * * @param request a {@code RequestSecurityToken} instance that contains the WS-Trust request information. * @param clientIndex an {@code int} that indicates which of the {@code STSClient} instances should be used to perform the * request. * @return an {@code Element} representing the security token that has been issued. * @throws WSTrustException if a WS-Trust exception is thrown by the STS. */ private Element issueInternal(RequestSecurityToken request, int clientIndex) throws WSTrustException { STSClient client = this.clients[clientIndex]; try { return client.issueToken(request); } catch (RuntimeException e) { // if this was a connection refused exception and we still have clients to try, call the next client. if (this.isCausedByConnectException(e) && clientIndex < this.clients.length - 1) { return this.issueInternal(request, ++clientIndex); } throw e; } }
@Override public Element issueToken(RequestSecurityToken request) throws WSTrustException { if (requestType.equals(WSTrustConstants.VALIDATE_REQUEST)) { request.setRequestType(URI.create(requestType)); ValidateTargetType validateTarget = new ValidateTargetType(); try { String sUserName = JBWSTokenIssuingLoginModule.this.getSharedUsername(); char[] cPassword = JBWSTokenIssuingLoginModule.this.getSharedPassword(); Element wsseUsernameToken = createUsernameToken(sUserName, (cPassword != null ? new String(cPassword) : null)); validateTarget.add(wsseUsernameToken); request.setValidateTarget(validateTarget); } catch (SOAPException e) { throw new WSTrustException(e); } } return super.issueToken(request); }
@Override public Element issueToken(RequestSecurityToken request) throws WSTrustException { if (requestType.equals(WSTrustConstants.VALIDATE_REQUEST)) { request.setRequestType(URI.create(requestType)); ValidateTargetType validateTarget = new ValidateTargetType(); try { String sUserName = JBWSTokenIssuingLoginModule.this.getSharedUsername(); char[] cPassword = JBWSTokenIssuingLoginModule.this.getSharedPassword(); Element wsseUsernameToken = createUsernameToken(sUserName, (cPassword != null ? new String(cPassword) : null)); validateTarget.add(wsseUsernameToken); request.setValidateTarget(validateTarget); } catch (SOAPException e) { throw new WSTrustException(e); } } return super.issueToken(request); }
/** * Issues a Security Token for the ultimate recipient of the token. * * @param endpointURI - The ultimate recipient of the token. This will be set at the AppliesTo for the RequestSecurityToken * which is an optional element so it may be null. * @return Element - The Security Token Element which will be of the TokenType configured for the endpointURI passed in. * @throws WSTrustException */ public Element issueTokenForEndpoint(String endpointURI) throws WSTrustException { RequestSecurityToken request = new RequestSecurityToken(); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } setAppliesTo(endpointURI, request); return issueToken(request); }
/** * Issues a Security Token for the ultimate recipient of the token. * * @param endpointURI * - The ultimate recipient of the token. This will be set at the AppliesTo for the RequestSecurityToken * which is an optional element so it may be null. * @return Element - The Security Token Element which will be of the TokenType configured for the endpointURI passed * in. * @throws WSTrustException */ public Element issueTokenForEndpoint(String endpointURI) throws WSTrustException { RequestSecurityToken request = new RequestSecurityToken(); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } setAppliesTo(endpointURI, request); return issueToken(request); }
/** * Issues a Security Token for the ultimate recipient of the token. * * @param endpointURI - The ultimate recipient of the token. This will be set at the AppliesTo for the * RequestSecurityToken * which is an optional element so it may be null. * * @return Element - The Security Token Element which will be of the TokenType configured for the endpointURI passed * in. * * @throws WSTrustException */ public Element issueTokenForEndpoint(String endpointURI) throws WSTrustException { RequestSecurityToken request = new RequestSecurityToken(); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } setAppliesTo(endpointURI, request); return issueToken(request); }
/** * Issues a Security Token for the ultimate recipient of the token. * * @param endpointURI - The ultimate recipient of the token. This will be set at the AppliesTo for the * RequestSecurityToken * which is an optional element so it may be null. * * @return Element - The Security Token Element which will be of the TokenType configured for the endpointURI passed * in. * * @throws WSTrustException */ public Element issueTokenForEndpoint(String endpointURI) throws WSTrustException { RequestSecurityToken request = new RequestSecurityToken(); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } setAppliesTo(endpointURI, request); return issueToken(request); }
/** * Issues a Security Token for the ultimate recipient of the token. * * @param endpointURI * - The ultimate recipient of the token. This will be set at the AppliesTo for the RequestSecurityToken * which is an optional element so it may be null. * @return Element - The Security Token Element which will be of the TokenType configured for the endpointURI passed * in. * @throws WSTrustException */ public Element issueTokenForEndpoint(String endpointURI) throws WSTrustException { RequestSecurityToken request = new RequestSecurityToken(); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } setAppliesTo(endpointURI, request); return issueToken(request); }
/** * Issue a token * * @param tokenType * * @return * * @throws WSTrustException */ public Element issueToken(String tokenType) throws WSTrustException { // create a custom token request message. RequestSecurityToken request = new RequestSecurityToken(); setTokenType(tokenType, request); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } if (wspAppliesTo != null) { request.setAppliesTo(WSTrustUtil.createAppliesTo(wspAppliesTo)); } // send the token request to JBoss STS and get the response. return issueToken(request); }
/** * Issue a token * * @param tokenType * @return * @throws WSTrustException */ public Element issueToken(String tokenType) throws WSTrustException { // create a custom token request message. RequestSecurityToken request = new RequestSecurityToken(); setTokenType(tokenType, request); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } if (wspAppliesTo != null) { request.setAppliesTo(WSTrustUtil.createAppliesTo(wspAppliesTo)); } // send the token request to JBoss STS and get the response. return issueToken(request); }
/** * Issue a token * * @param tokenType * * @return * * @throws WSTrustException */ public Element issueToken(String tokenType) throws WSTrustException { // create a custom token request message. RequestSecurityToken request = new RequestSecurityToken(); setTokenType(tokenType, request); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } if (wspAppliesTo != null) { request.setAppliesTo(WSTrustUtil.createAppliesTo(wspAppliesTo)); } // send the token request to JBoss STS and get the response. return issueToken(request); }
/** * Issue a token * @param tokenType * @return * @throws WSTrustException */ public Element issueToken(String tokenType) throws WSTrustException { // create a custom token request message. RequestSecurityToken request = new RequestSecurityToken(); setTokenType(tokenType, request); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } if (wspAppliesTo != null) { request.setAppliesTo(WSTrustUtil.createAppliesTo(wspAppliesTo)); } // send the token request to JBoss STS and get the response. return issueToken(request); }
/** * Issue a token * @param tokenType * @return * @throws WSTrustException */ public Element issueToken(String tokenType) throws WSTrustException { // create a custom token request message. RequestSecurityToken request = new RequestSecurityToken(); setTokenType(tokenType, request); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } if (wspAppliesTo != null) { request.setAppliesTo(WSTrustUtil.createAppliesTo(wspAppliesTo)); } // send the token request to JBoss STS and get the response. return issueToken(request); }
/** * Issues a Security Token from the STS. This methods has the option of specifying one or both of endpointURI/tokenType but * at least one must specified. * * @param endpointURI - The ultimate recipient of the token. This will be set at the AppliesTo for the RequestSecurityToken * which is an optional element so it may be null. * @param tokenType - The type of security token to be issued. * @return Element - The Security Token Element issued. * @throws IllegalArgumentException If neither endpointURI nor tokenType was specified. * @throws WSTrustException */ public Element issueToken(String endpointURI, String tokenType) throws WSTrustException { if (endpointURI == null && tokenType == null) throw logger.nullArgumentError("endpointURI or tokenType"); RequestSecurityToken request = new RequestSecurityToken(); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } setAppliesTo(endpointURI, request); setTokenType(tokenType, request); return issueToken(request); }
/** * <p> * Issues a security token on behalf of the specified principal. * </p> * * @param endpointURI the ultimate recipient of the token. This will be set at the AppliesTo for the RequestSecurityToken * which is an optional element so it may be null. * @param tokenType the type of the token to be issued. * @param principal the {@code Principal} to whom the token will be issued. * @return an {@code Element} representing the issued security token. * @throws IllegalArgumentException If neither endpointURI nor tokenType was specified. * @throws WSTrustException if an error occurs while issuing the security token. */ public Element issueTokenOnBehalfOf(String endpointURI, String tokenType, Principal principal) throws WSTrustException { if (endpointURI == null && tokenType == null) throw logger.nullArgumentError("endpointURI or tokenType"); RequestSecurityToken request = new RequestSecurityToken(); if (wsaIssuerAddress != null) { request.setIssuer(WSTrustUtil.createIssuer(wsaIssuerAddress)); } setAppliesTo(endpointURI, request); setTokenType(tokenType, request); setOnBehalfOf(principal, request); return issueToken(request); }