Package org.apache.cxf.rt.security.saml

Examples of org.apache.cxf.rt.security.saml.SAMLSecurityContext


       
        ClaimCollection claims = SAMLUtils.getClaims(assertion);
        Set<Principal> roles =
            SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null);
       
        SAMLSecurityContext context =
            new SAMLSecurityContext(principal, roles, claims);
       
        return context.getUserRoles();
    }
View Full Code Here


                org.apache.cxf.rt.security.saml.SAMLUtils.getClaims(assertionWrapper);
            Set<Principal> roles =
                org.apache.cxf.rt.security.saml.SAMLUtils.parseRolesFromClaims(
                    claims, roleAttributeName, null);

            SAMLSecurityContext context =
                new SAMLSecurityContext(new SimplePrincipal(name), roles, claims);
            context.setIssuer(org.apache.cxf.rt.security.saml.SAMLUtils.getIssuer(assertionWrapper));
            context.setAssertionElement(
                org.apache.cxf.rt.security.saml.SAMLUtils.getAssertionElement(assertionWrapper));
            m.put(SecurityContext.class, context);
        }
    }
View Full Code Here

        String nameFormat =
            defaultNameFormat == null ? SAML2Constants.ATTRNAME_FORMAT_UNSPECIFIED : defaultNameFormat;
        Set<Principal> roles =
            SAMLUtils.parseRolesFromClaims(claims, roleName, nameFormat);
       
        SAMLSecurityContext context =
            new SAMLSecurityContext(subjectPrincipal, roles, claims);
        return context;
    }
View Full Code Here

                    ClaimCollection claims =
                        SAMLUtils.getClaims((SamlAssertionWrapper)receivedAssertion);
                    Set<Principal> roles =
                        SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null);
                   
                    SAMLSecurityContext context =
                        new SAMLSecurityContext(p, roles, claims);
                    context.setIssuer(SAMLUtils.getIssuer(receivedAssertion));
                    context.setAssertionElement(SAMLUtils.getAssertionElement(receivedAssertion));
                    msg.put(SecurityContext.class, context);
                } else {
                    msg.put(SecurityContext.class, createSecurityContext(p));
                }
                break;
View Full Code Here

                    ClaimCollection claims =
                        SAMLUtils.getClaims((SamlAssertionWrapper)receivedAssertion);
                    Set<Principal> roles =
                        SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null);
                   
                    SAMLSecurityContext context =
                        new SAMLSecurityContext(p, roles, claims);
                    context.setIssuer(SAMLUtils.getIssuer(receivedAssertion));
                    context.setAssertionElement(SAMLUtils.getAssertionElement(receivedAssertion));
                    msg.put(SecurityContext.class, context);
                } else {
                    msg.put(SecurityContext.class, createSecurityContext(p));
                }
                break;
View Full Code Here

                            ClaimCollection claims =
                                SAMLUtils.getClaims((SamlAssertionWrapper)receivedAssertion);
                            Set<Principal> roles =
                                SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null);
                           
                            SAMLSecurityContext context =
                                new SAMLSecurityContext(p, roles, claims);
                           
                            msg.put(SecurityContext.class, context);
                        }
                    } else {
                        msg.put(SecurityContext.class, createSecurityContext(p));
View Full Code Here

       
        Set<Principal> roles =
            SAMLUtils.parseRolesFromClaims(claims, SAMLClaim.SAML_ROLE_ATTRIBUTENAME_DEFAULT,
                                           SAML2Constants.ATTRNAME_FORMAT_UNSPECIFIED);
       
        SecurityContext sc = new SAMLSecurityContext(new SimplePrincipal("user"), roles, 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

    }

    protected UserSubject getGrantSubject(Message message, SamlAssertionWrapper wrapper) {
        SecurityContext sc = scProvider.getSecurityContext(message, wrapper);
        if (sc instanceof SAMLSecurityContext) {
            SAMLSecurityContext jaxrsSc = (SAMLSecurityContext)sc;
            Set<Principal> rolesP = jaxrsSc.getUserRoles();
            List<String> roles = new ArrayList<String>();
            if (roles != null) {
                for (Principal p : rolesP) {
                    roles.add(p.getName());
                }
            }
            return new SamlUserSubject(jaxrsSc.getUserPrincipal().getName(),
                                       roles,
                                       jaxrsSc.getClaims());
        } else {
            return new UserSubject(sc.getUserPrincipal().getName());
        }
       
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.rt.security.saml.SAMLSecurityContext

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.