Package org.apache.cxf.rs.security.saml.assertion

Examples of org.apache.cxf.rs.security.saml.assertion.Subject


       
    }
   
    public static Subject getSubject(Message message, AssertionWrapper assertionW) {
        org.opensaml.saml2.core.Subject s = assertionW.getSaml2().getSubject();
        Subject subject = new Subject();
        NameID nameId = s.getNameID();
        subject.setNameQualifier(nameId.getNameQualifier());
        // if format is transient then we may need to use STSClient
        // to request an alternate name from IDP
        subject.setNameFormat(nameId.getFormat());
       
        subject.setName(nameId.getValue());
        subject.setSpId(nameId.getSPProvidedID());
        subject.setSpQualifier(nameId.getSPNameQualifier());
        return subject;
    }
View Full Code Here


    private static final String ROLE_NAMEFORMAT_PROPERTY = "org.apache.cxf.saml.claims.role.nameformat";
   
    public SecurityContext getSecurityContext(Message message,
            AssertionWrapper wrapper) {
        Claims claims = getClaims(wrapper);
        Subject subject = getSubject(message, wrapper, claims);
        SecurityContext securityContext = doGetSecurityContext(message, subject, claims);
        if (securityContext instanceof SAMLSecurityContext) {
            Element assertionElement = wrapper.getElement();
            ((SAMLSecurityContext)securityContext).setAssertionElement(assertionElement);
        }
View Full Code Here

        // signature, subject confirmation, etc
        super.validateToken(message, wrapper);
       
        // This is specific to OAuth2 path
        // Introduce SAMLOAuth2Validator to be reused between auth and grant handlers
        Subject subject = SAMLUtils.getSubject(message, wrapper);
        if (subject.getName() == null) {
            throw ExceptionUtils.toNotAuthorizedException(null, null)
        }
       
        if (clientId != null && !clientId.equals(subject.getName())) {
            //TODO:  Attempt to map client_id to subject.getName()
            throw ExceptionUtils.toNotAuthorizedException(null, null);
        }
        samlOAuthValidator.validate(message, wrapper);
        message.put(OAuthConstants.CLIENT_ID, subject.getName());
    }
View Full Code Here

        return true;
    }
   
    protected void setSecurityContext(Message m, AssertionWrapper assertionWrapper) {
        // don't worry about roles/claims for now, just set a basic SecurityContext
        Subject subject = SAMLUtils.getSubject(m, assertionWrapper);
        final String name = subject.getName();
        if (name != null) {
            String roleAttributeName = (String)m.getContextualProperty(
                    SecurityConstants.SAML_ROLE_ATTRIBUTENAME);
            if (roleAttributeName == null || roleAttributeName.length() == 0) {
                roleAttributeName = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role";
View Full Code Here

        }
        return true;
    }
   
    protected void setSecurityContext(Message m, SamlAssertionWrapper assertionWrapper) {
        Subject subject = SAMLUtils.getSubject(m, assertionWrapper);
        final String name = subject.getName();
       
        if (name != null) {
            String roleAttributeName =
                (String)m.getContextualProperty(SecurityConstants.SAML_ROLE_ATTRIBUTENAME);
            if (roleAttributeName == null || roleAttributeName.length() == 0) {
View Full Code Here

       
    }
   
    public static Subject getSubject(Message message, SamlAssertionWrapper assertionW) {
        org.opensaml.saml2.core.Subject s = assertionW.getSaml2().getSubject();
        Subject subject = new Subject();
        NameID nameId = s.getNameID();
        subject.setNameQualifier(nameId.getNameQualifier());
        // if format is transient then we may need to use STSClient
        // to request an alternate name from IDP
        subject.setNameFormat(nameId.getFormat());
       
        subject.setName(nameId.getValue());
        subject.setSpId(nameId.getSPProvidedID());
        subject.setSpQualifier(nameId.getSPNameQualifier());
        return subject;
    }
View Full Code Here

    private static final String ROLE_NAMEFORMAT_PROPERTY = "org.apache.cxf.saml.claims.role.nameformat";
   
    public SecurityContext getSecurityContext(Message message,
            SamlAssertionWrapper wrapper) {
        ClaimCollection claims = getClaims(wrapper);
        Subject subject = getSubject(message, wrapper, claims);
        SecurityContext securityContext = doGetSecurityContext(message, subject, claims);
        if (securityContext instanceof SAMLSecurityContext) {
            Element assertionElement = wrapper.getElement();
            ((SAMLSecurityContext)securityContext).setAssertionElement(assertionElement);
        }
View Full Code Here

    private static final String ROLE_NAMEFORMAT_PROPERTY = "org.apache.cxf.saml.claims.role.nameformat";
   
    public SecurityContext getSecurityContext(Message message,
            AssertionWrapper wrapper) {
        Claims claims = getClaims(wrapper);
        Subject subject = getSubject(message, wrapper, claims);
        return doGetSecurityContext(message, subject, claims);
    }
View Full Code Here

            org.apache.cxf.rs.security.saml.assertion.Claim... claim)
        throws Exception {
        List<org.apache.cxf.rs.security.saml.assertion.Claim> claims =
            new ArrayList<org.apache.cxf.rs.security.saml.assertion.Claim>(Arrays.asList(claim));
        SecurityContext sc = new SAMLSecurityContext(
                new Subject("user"), claims);
        Message m = new MessageImpl();
        m.setExchange(new ExchangeImpl());
        m.put(SecurityContext.class, sc);
        m.put("org.apache.cxf.resource.method",
               cls.getMethod(methodName, new Class[]{}));
View Full Code Here

        return true;
    }
   
    protected void setSecurityContext(Message m, AssertionWrapper assertionWrapper) {
        // don't worry about roles/claims for now, just set a basic SecurityContext
        Subject subject = SAMLUtils.getSubject(m, assertionWrapper);
        final String name = subject.getName();
       
        if (name != null) {
            final SecurityContext sc = new SecurityContext() {

                public Principal getUserPrincipal() {
View Full Code Here

TOP

Related Classes of org.apache.cxf.rs.security.saml.assertion.Subject

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.