private Set<Principal> getRoles(Message msg, Credential credential) { SamlAssertionWrapper samlAssertion = credential.getTransformedToken(); if (samlAssertion == null) { samlAssertion = credential.getSamlAssertion(); } if (samlAssertion != null) { String roleAttributeName = null; if (msg != null) { roleAttributeName = (String)SecurityUtils.getSecurityPropertyValue(SecurityConstants.SAML_ROLE_ATTRIBUTENAME, msg); } if (roleAttributeName == null || roleAttributeName.length() == 0) { roleAttributeName = WSS4JInInterceptor.SAML_ROLE_ATTRIBUTENAME_DEFAULT; } ClaimCollection claims = SAMLUtils.getClaims(samlAssertion); return SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null); } return Collections.emptySet(); }
private Set<Principal> getRoles(Message msg, Credential credential) { SamlAssertionWrapper samlAssertion = credential.getTransformedToken(); if (samlAssertion == null) { samlAssertion = credential.getSamlAssertion(); } if (samlAssertion != null) { String roleAttributeName = null; if (msg != null) { roleAttributeName = (String)SecurityUtils.getSecurityPropertyValue(SecurityConstants.SAML_ROLE_ATTRIBUTENAME, msg); } if (roleAttributeName == null || roleAttributeName.length() == 0) { roleAttributeName = WSS4JInInterceptor.SAML_ROLE_ATTRIBUTENAME_DEFAULT; } ClaimCollection claims = SAMLUtils.getClaims(samlAssertion); return SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null); } return Collections.emptySet(); }
if (credential.getTransformedToken() != null) { result.put( WSSecurityEngineResult.TAG_TRANSFORMED_TOKEN, credential.getTransformedToken() ); if (credential.getPrincipal() != null) { } else { SAMLTokenPrincipalImpl samlPrincipal = new SAMLTokenPrincipalImpl(credential.getTransformedToken()); result.put(WSSecurityEngineResult.TAG_PRINCIPAL, samlPrincipal);
result.put(WSSecurityEngineResult.TAG_SECRET, returnedCredential.getSecretKey()); if (returnedCredential.getTransformedToken() != null) { result.put( WSSecurityEngineResult.TAG_TRANSFORMED_TOKEN, returnedCredential.getTransformedToken() ); if (credential.getPrincipal() != null) { } else { SAMLTokenPrincipalImpl samlPrincipal = new SAMLTokenPrincipalImpl(credential.getTransformedToken()); result.put(WSSecurityEngineResult.TAG_PRINCIPAL, samlPrincipal);
protected SecurityContext createSecurityContext(Message msg, Credential credential) { SamlAssertionWrapper samlAssertion = credential.getTransformedToken(); if (samlAssertion == null) { samlAssertion = credential.getSamlAssertion(); } if (samlAssertion != null) { String roleAttributeName = (String)SecurityUtils.getSecurityPropertyValue(SecurityConstants.SAML_ROLE_ATTRIBUTENAME, msg); if (roleAttributeName == null || roleAttributeName.length() == 0) { roleAttributeName = SAML_ROLE_ATTRIBUTENAME_DEFAULT; } ClaimCollection claims = SAMLUtils.getClaims(samlAssertion); Set<Principal> roles = SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null); SAMLSecurityContext context = new SAMLSecurityContext(credential.getPrincipal(), roles, claims); context.setIssuer(SAMLUtils.getIssuer(samlAssertion)); context.setAssertionElement(SAMLUtils.getAssertionElement(samlAssertion)); return context; } return createSecurityContext(credential.getPrincipal()); }
if (credential.getTransformedToken() != null) { result.put( WSSecurityEngineResult.TAG_TRANSFORMED_TOKEN, credential.getTransformedToken() ); if (credential.getPrincipal() != null) { } else { SAMLTokenPrincipalImpl samlPrincipal = new SAMLTokenPrincipalImpl(credential.getTransformedToken()); result.put(WSSecurityEngineResult.TAG_PRINCIPAL, samlPrincipal);