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

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


       
    }
   
    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


        // 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

        // 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 new NotAuthorizedException(errorResponse())
        }
       
        if (clientId != null && !clientId.equals(subject.getName())) {
            //TODO:  Attempt to map client_id to subject.getName()
            throw new NotAuthorizedException(errorResponse());
        }
        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) {
            final SecurityContext sc = new SecurityContext() {

                public Principal getUserPrincipal() {
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

        return true;
    }
   
    protected void setSecurityContext(Message m, SamlAssertionWrapper 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

            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

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.