Package org.apache.wss4j.common.saml.bean

Examples of org.apache.wss4j.common.saml.bean.AttributeBean


        String tokenType = providerParameters.getTokenRequirements().getTokenType();
       
        AttributeStatementBean attrBean = new AttributeStatementBean();
        while (claimIterator.hasNext()) {
            ProcessedClaim claim = claimIterator.next();
            AttributeBean attributeBean = new AttributeBean();
           
            URI claimType = claim.getClaimType();
            if (WSConstants.WSS_SAML2_TOKEN_TYPE.equals(tokenType)
                || WSConstants.SAML2_NS.equals(tokenType)) {
                attributeBean.setQualifiedName(claimType.toString());
                attributeBean.setNameFormat(nameFormat);
            } else {
                String uri = claimType.toString();
                int lastSlash = uri.lastIndexOf("/");
                if (lastSlash == (uri.length() - 1)) {
                    uri = uri.substring(0, lastSlash);
                    lastSlash = uri.lastIndexOf("/");
                }

                String namespace = uri.substring(0, lastSlash);
                String name = uri.substring(lastSlash + 1, uri.length());
               
                attributeBean.setSimpleName(name);
                attributeBean.setQualifiedName(namespace);
            }
            attributeBean.setAttributeValues(claim.getValues());
           
            attributeList.add(attributeBean);
        }
        attrBean.setSamlAttributes(attributeList);
View Full Code Here


public class SAMLClaimsTest extends Assert {

    @org.junit.Test
    public void testSAML2Claims() throws Exception {
        AttributeBean attributeBean = new AttributeBean();
        attributeBean.setQualifiedName(SAMLClaim.SAML_ROLE_ATTRIBUTENAME_DEFAULT);
        attributeBean.setNameFormat(SAML2Constants.ATTRNAME_FORMAT_UNSPECIFIED);
        attributeBean.addAttributeValue("employee");
       
        SamlCallbackHandler samlCallbackHandler = new SamlCallbackHandler();
        samlCallbackHandler.setAttributes(Collections.singletonList(attributeBean));
       
        // Create the SAML Assertion via the CallbackHandler
View Full Code Here

        assertEquals("employee", p.getName());
    }
   
    @org.junit.Test
    public void testSAML2MultipleRoles() throws Exception {
        AttributeBean attributeBean = new AttributeBean();
        attributeBean.setQualifiedName(SAMLClaim.SAML_ROLE_ATTRIBUTENAME_DEFAULT);
        attributeBean.setNameFormat(SAML2Constants.ATTRNAME_FORMAT_UNSPECIFIED);
        attributeBean.addAttributeValue("employee");
        attributeBean.addAttributeValue("boss");
       
        SamlCallbackHandler samlCallbackHandler = new SamlCallbackHandler();
        samlCallbackHandler.setAttributes(Collections.singletonList(attributeBean));
       
        // Create the SAML Assertion via the CallbackHandler
View Full Code Here

        assertEquals(2, roles.size());
    }
   
    @org.junit.Test
    public void testSAML2MultipleClaims() throws Exception {
        AttributeBean attributeBean = new AttributeBean();
        attributeBean.setQualifiedName(SAMLClaim.SAML_ROLE_ATTRIBUTENAME_DEFAULT);
        attributeBean.setNameFormat(SAML2Constants.ATTRNAME_FORMAT_UNSPECIFIED);
        attributeBean.addAttributeValue("employee");
       
        AttributeBean attributeBean2 = new AttributeBean();
        attributeBean2.setQualifiedName(
                "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname");
        attributeBean2.setNameFormat(SAML2Constants.ATTRNAME_FORMAT_UNSPECIFIED);
        attributeBean2.addAttributeValue("smith");
       
        SamlCallbackHandler samlCallbackHandler = new SamlCallbackHandler();
        List<AttributeBean> attributes = new ArrayList<AttributeBean>();
        attributes.add(attributeBean);
        attributes.add(attributeBean2);
View Full Code Here

        assertEquals("employee", p.getName());
    }
   
    @org.junit.Test
    public void testSAML1Claims() throws Exception {
        AttributeBean attributeBean = new AttributeBean();
        attributeBean.setSimpleName("role");
        attributeBean.setQualifiedName("http://schemas.xmlsoap.org/ws/2005/05/identity/claims");
        attributeBean.addAttributeValue("employee");
       
        SamlCallbackHandler samlCallbackHandler = new SamlCallbackHandler(false);
        samlCallbackHandler.setAttributes(Collections.singletonList(attributeBean));
       
        // Create the SAML Assertion via the CallbackHandler
View Full Code Here

TOP

Related Classes of org.apache.wss4j.common.saml.bean.AttributeBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.