use of org.apache.shiro.authc.AuthenticationException in project ddf by codice.
the class AbstractStsRealm method requestSecurityToken.
/**
* Request a security token (SAML assertion) from the STS.
*
* @param authToken The subject the security token is being request for.
* @return security token (SAML assertion)
*/
protected SecurityToken requestSecurityToken(Object authToken) {
SecurityToken token = null;
String stsAddress = getAddress();
try {
LOGGER.debug("Requesting security token from STS at: {}.", stsAddress);
if (authToken != null) {
LOGGER.debug("Telling the STS to request a security token on behalf of the auth token");
STSClient stsClient = configureStsClient();
stsClient.setWsdlLocation(stsAddress);
stsClient.setOnBehalfOf(authToken);
stsClient.setTokenType(getAssertionType());
stsClient.setKeyType(getKeyType());
stsClient.setKeySize(Integer.parseInt(getKeySize()));
token = stsClient.requestSecurityToken(stsAddress);
LOGGER.debug("Finished requesting security token.");
}
} catch (Exception e) {
String msg = "Error requesting the security token from STS at: " + stsAddress + ".";
LOGGER.debug(msg, e);
throw new AuthenticationException(msg, e);
}
return token;
}
Aggregations