Package org.apache.cxf.sts.claims

Examples of org.apache.cxf.sts.claims.RequestClaimCollection


        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("A");
        parameters.setPrincipal(new CustomTokenPrincipal("alice"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
View Full Code Here


        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("B");
        parameters.setPrincipal(new CustomTokenPrincipal("ALICE"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
View Full Code Here

        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("A");
        parameters.setPrincipal(new CustomTokenPrincipal("alice"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
View Full Code Here

        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("B");
        parameters.setPrincipal(new CustomTokenPrincipal("ALICE"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
View Full Code Here

        //Asserts in RealmSupportClaimsHandler must succeed
       
    }
   
    private RequestClaimCollection createRequestClaimCollection() {
        RequestClaimCollection requestedClaims = new RequestClaimCollection();
        RequestClaim requestClaimA = new RequestClaim();
        requestClaimA.setClaimType(URI.create("Claim-A"));
        requestClaimA.setOptional(false);
        requestedClaims.add(requestClaimA);
        RequestClaim requestClaimB = new RequestClaim();
        requestClaimB.setClaimType(URI.create("Claim-B"));
        requestClaimB.setOptional(false);
        requestedClaims.add(requestClaimB);
        RequestClaim requestClaimC = new RequestClaim();
        requestClaimC.setClaimType(URI.create("Claim-C"));
        requestClaimC.setOptional(true);
        requestedClaims.add(requestClaimC);
        return requestedClaims;
    }
View Full Code Here

            }         
            tokenRequirements.setRenewTarget(renewTarget);
            LOG.fine("Found CancelTarget token");
        } else if (QNameConstants.CLAIMS.equals(jaxbElement.getName())) {
            ClaimsType claimsType = (ClaimsType)jaxbElement.getValue();
            RequestClaimCollection requestedClaims = parseClaims(claimsType, claimsParsers);
            tokenRequirements.setPrimaryClaims(requestedClaims);
            LOG.fine("Found Primary Claims token");
        } else if (QNameConstants.RENEWING.equals(jaxbElement.getName())) {
            RenewingType renewingType = (RenewingType)jaxbElement.getValue();
            Renewing renewing = new Renewing();
View Full Code Here

                String keyType = child.getTextContent().trim();
                LOG.fine("Found KeyType: " + keyType);
                keyRequirements.setKeyType(keyType);
            } else if ("Claims".equals(localName) && STSConstants.WST_NS_05_12.equals(namespace)) {
                LOG.fine("Found Secondary Claims element");
                RequestClaimCollection requestedClaims = parseClaims(child, claimsParsers);
                tokenRequirements.setSecondaryClaims(requestedClaims);
            } else {
                LOG.fine("Found unknown element: " + localName + " " + namespace);
            }
            child = DOMUtils.getNextElement(child);
View Full Code Here

    /**
     * Create a RequestClaimCollection from a DOM Element
     */
    private RequestClaimCollection parseClaims(Element claimsElement, List<ClaimsParser> claimsParsers) {
        String dialectAttr = null;
        RequestClaimCollection requestedClaims = new RequestClaimCollection();
        try {
            dialectAttr = claimsElement.getAttributeNS(null, "Dialect");
            if (dialectAttr != null && !"".equals(dialectAttr)) {
                requestedClaims.setDialect(new URI(dialectAttr));
            }
        } catch (URISyntaxException e1) {
            LOG.log(
                Level.WARNING,
                "Cannot create URI from the given Dialect attribute value " + dialectAttr,
                e1
            );
        }
       
        Element childClaimType = DOMUtils.getFirstElement(claimsElement);
        while (childClaimType != null) {
            RequestClaim requestClaim = parseChildClaimType(childClaimType, dialectAttr, claimsParsers);
            if (requestClaim != null) {
                requestedClaims.add(requestClaim);
            }
            childClaimType = DOMUtils.getNextElement(childClaimType);
        }
       
        return requestedClaims;
View Full Code Here

     */
    private static RequestClaimCollection parseClaims(
        ClaimsType claimsType, List<ClaimsParser> claimsParsers
    ) {
        String dialectAttr = null;
        RequestClaimCollection requestedClaims = new RequestClaimCollection();
        try {
            dialectAttr = claimsType.getDialect();
            if (dialectAttr != null && !"".equals(dialectAttr)) {
                requestedClaims.setDialect(new URI(dialectAttr));
            }
        } catch (URISyntaxException e1) {
            LOG.log(
                Level.WARNING,
                "Cannot create URI from the given Dialect attribute value " + dialectAttr,
                e1
            );
        }
       
        for (Object claim : claimsType.getAny()) {
            if (claim instanceof Element) {
                RequestClaim requestClaim = parseChildClaimType((Element)claim, dialectAttr, claimsParsers);
                if (requestClaim != null) {
                    requestedClaims.add(requestClaim);
                }
            }
        }
       
        return requestedClaims;
View Full Code Here

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

TOP

Related Classes of org.apache.cxf.sts.claims.RequestClaimCollection

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.