{
if (logger.isTraceEnabled())
logger.trace("SAML V2.0 token validation started");
// get the SAML assertion that must be validated.
ValidateTargetType validateTarget = context.getRequestSecurityToken().getValidateTarget();
if(validateTarget == null)
throw new WSTrustException("Invalid validate message: missing required ValidateTarget");
String code = WSTrustConstants.STATUS_CODE_VALID;
String reason = "SAMLV2.0 Assertion successfuly validated";
AssertionType assertion = null;
Object assertionObj = validateTarget.getAny();
if(assertionObj instanceof JAXBElement)
{
JAXBElement<AssertionType> assertionType = (JAXBElement<AssertionType>) validateTarget.getAny();
assertion = assertionType.getValue();
}
else if(assertionObj instanceof Element)
{
Element assertionElement = (Element) assertionObj;