Package org.apache.cxf.rt.security.claims

Examples of org.apache.cxf.rt.security.claims.ClaimCollection


        }
       
        if (claimsToSerialize instanceof Element) {
            StaxUtils.copy((Element)claimsToSerialize, writer);
        } else if (claimsToSerialize instanceof ClaimCollection) {
            ClaimCollection claimCollection = (ClaimCollection)claims;
            claimCollection.serialize(writer, "wst", namespace);
        }
    }
View Full Code Here


                            SecurityConstants.SAML_ROLE_ATTRIBUTENAME);
                    if (roleAttributeName == null || roleAttributeName.length() == 0) {
                        roleAttributeName = SAML_ROLE_ATTRIBUTENAME_DEFAULT;
                    }
                   
                    ClaimCollection claims =
                        SAMLUtils.getClaims((SamlAssertionWrapper)receivedAssertion);
                    Set<Principal> roles =
                        SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null);
                   
                    SAMLSecurityContext context =
View Full Code Here

                        }
                       
                        SamlTokenSecurityEvent samlEvent = (SamlTokenSecurityEvent)event;
                        receivedAssertion = samlEvent.getSamlAssertionWrapper();
                        if (receivedAssertion != null) {
                            ClaimCollection claims =
                                SAMLUtils.getClaims((SamlAssertionWrapper)receivedAssertion);
                            Set<Principal> roles =
                                SAMLUtils.parseRolesFromClaims(claims, roleAttributeName, null);
                           
                            SAMLSecurityContext context =
View Full Code Here

        }
       
        if (claimsToSerialize instanceof Element) {
            StaxUtils.copy((Element)claimsToSerialize, writer);
        } else if (claimsToSerialize instanceof ClaimCollection) {
            ClaimCollection claimCollection = (ClaimCollection)claims;
            claimCollection.serialize(writer, "wst", namespace);
        }
    }
View Full Code Here

            RequestParser requestParser = parseRequest(request, context);
   
            providerParameters = createTokenProviderParameters(requestParser, context);
   
            // Check if the requested claims can be handled by the configured claim handlers
            ClaimCollection requestedClaims = providerParameters.getRequestedPrimaryClaims();
            checkClaimsSupport(requestedClaims);
            requestedClaims = providerParameters.getRequestedSecondaryClaims();
            checkClaimsSupport(requestedClaims);
            providerParameters.setClaimsManager(claimsManager);
           
View Full Code Here

       
        // Here we have two sets of claims
        if (primaryClaims.getDialect() != null
            && primaryClaims.getDialect().equals(secondaryClaims.getDialect())) {
            // Matching dialects - so we must merge them
            ClaimCollection mergedClaims = mergeClaims(primaryClaims, secondaryClaims);
            return retrieveClaimValues(mergedClaims, parameters);
        } else {
            // If the dialects don't match then just return all Claims
            ProcessedClaimCollection claims = retrieveClaimValues(primaryClaims, parameters);
            ProcessedClaimCollection claims2 = retrieveClaimValues(secondaryClaims, parameters);
View Full Code Here

            }
            Principal originalPrincipal = parameters.getPrincipal();
            ProcessedClaimCollection returnCollection = new ProcessedClaimCollection();
            for (ClaimsHandler handler : claimHandlers) {
               
                ClaimCollection supportedClaims =
                    filterHandlerClaims(claims, handler.getSupportedClaimTypes());
                if (supportedClaims.isEmpty()) {
                    continue;
                }
               
                if (handler instanceof RealmSupport) {
                    RealmSupport handlerRealmSupport = (RealmSupport)handler;
View Full Code Here

    }

    private ClaimCollection filterHandlerClaims(ClaimCollection claims,
                                                         List<URI> handlerClaimTypes) {
        ClaimCollection supportedClaims = new ClaimCollection();
        supportedClaims.setDialect(claims.getDialect());
        for (Claim claim : claims) {
            if (handlerClaimTypes.contains(claim.getClaimType())) {
                supportedClaims.add(claim);
            }
        }
        return supportedClaims;
    }
View Full Code Here

     * with any client-specific claims sent in wst:RequestSecurityToken/wst:Claims
     */
    private ClaimCollection mergeClaims(
        ClaimCollection primaryClaims, ClaimCollection secondaryClaims
    ) {
        ClaimCollection parsedClaims = new ClaimCollection();
        parsedClaims.addAll(secondaryClaims);
       
        // Merge claims
        ClaimCollection mergedClaims = new ClaimCollection();
        mergedClaims.setDialect(primaryClaims.getDialect());
       
        for (Claim claim : primaryClaims) {
            Claim matchingClaim = null;
            // Search for a matching claim via the ClaimType URI
            for (Claim secondaryClaim : parsedClaims) {
                if (secondaryClaim.getClaimType().equals(claim.getClaimType())) {
                    matchingClaim = secondaryClaim;
                    break;
                }
            }
           
            if (matchingClaim == null) {
                mergedClaims.add(claim);
            } else {
                Claim mergedClaim = new Claim();
                mergedClaim.setClaimType(claim.getClaimType());
                if (claim.getValues() != null && !claim.getValues().isEmpty()) {
                    mergedClaim.setValues(claim.getValues());
                    if (matchingClaim.getValues() != null && !matchingClaim.getValues().isEmpty()) {
                        LOG.log(Level.WARNING, "Secondary claim value " + matchingClaim.getValues()
                                + " ignored in favour of primary claim value");
                    }
                } else if (matchingClaim.getValues() != null && !matchingClaim.getValues().isEmpty()) {
                    mergedClaim.setValues(matchingClaim.getValues());
                }
                mergedClaims.add(mergedClaim);
               
                // Remove from parsed Claims
                parsedClaims.remove(matchingClaim);
            }
        }
       
        // Now add in any claims from the parsed claims that weren't merged
        mergedClaims.addAll(parsedClaims);
       
        return mergedClaims;
    }
View Full Code Here

            String realm = realmParser.parseRealm(context);
            providerParameters.setRealm(realm);
        }
       
        // Set the requested Claims
        ClaimCollection claims = tokenRequirements.getPrimaryClaims();
        providerParameters.setRequestedPrimaryClaims(claims);
        claims = tokenRequirements.getSecondaryClaims();
        providerParameters.setRequestedSecondaryClaims(claims);
       
        EncryptionProperties encryptionProperties = stsProperties.getEncryptionProperties();
View Full Code Here

TOP

Related Classes of org.apache.cxf.rt.security.claims.ClaimCollection

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.