public static String getIssuer(Object assertion) { return ((SamlAssertionWrapper)assertion).getIssuerString(); }
@Override public String getIssuerName() throws WSSecurityException { return getSamlAssertionWrapper().getIssuerString(); }
/** * Get the Issuer of the SAML Assertion */ public String getIssuer() throws WSSecurityException { SecurityContext sc = message.get(SecurityContext.class); if (sc instanceof SAMLSecurityContext) { Element assertionElement = ((SAMLSecurityContext)sc).getAssertionElement(); if (assertionElement != null) { SamlAssertionWrapper wrapper = new SamlAssertionWrapper(assertionElement); return wrapper.getIssuerString(); } } return null; } }
SamlAssertionWrapper assertion = validatedCredential.getSamlAssertion(); if (!"alice".equals(assertion.getIssuerString())) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity");
@Override public Credential validate(Credential credential, RequestData data) throws WSSecurityException { Credential validatedCredential = super.validate(credential, data); SamlAssertionWrapper assertion = validatedCredential.getSamlAssertion(); if (!"sts".equals(assertion.getIssuerString())) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity"); } Assertion saml2Assertion = assertion.getSaml2(); if (saml2Assertion == null) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity"); } List<AttributeStatement> attributeStatements = saml2Assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity"); } return validatedCredential; }
samlAssertion = credential.getSamlAssertion(); if (LOG.isDebugEnabled()) { LOG.debug("SAML Assertion issuer " + samlAssertion.getIssuerString()); LOG.debug(DOM2Writer.nodeToString(elem));