* checks that we get back a SAML2 Assertion from the STS, and extracts the secret from it.
*/
public class SCTTokenValidator extends STSTokenValidator {
public Credential validate(Credential credential, RequestData data) throws WSSecurityException {
Credential validatedCredential = super.validate(credential, data);
SamlAssertionWrapper transformedToken = validatedCredential.getTransformedToken();
if (transformedToken == null || transformedToken.getSaml2() == null
|| !"DoubleItSTSIssuer".equals(transformedToken.getIssuerString())) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE);
}
Document doc = transformedToken.getElement().getOwnerDocument();
transformedToken.parseHOKSubject(
new WSSSAMLKeyInfoProcessor(data, new WSDocInfo(doc)), data.getSigVerCrypto(),
data.getCallbackHandler()
);
SAMLKeyInfo keyInfo = transformedToken.getSubjectKeyInfo();
byte[] secret = keyInfo.getSecret();
validatedCredential.setSecretKey(secret);
return validatedCredential;
}