Package org.apache.cxf.fediz.core.config

Examples of org.apache.cxf.fediz.core.config.FederationProtocol


                claims = parseClaimsInAssertion(assertion.getSaml1());
                audience = getAudienceRestriction(assertion.getSaml1());
            }

            List<String> roles = null;
            FederationProtocol fp = (FederationProtocol)config.getProtocol();
            if (fp.getRoleURI() != null) {
                URI roleURI = URI.create(fp.getRoleURI());
                String delim = fp.getRoleDelimiter();
                for (Claim c : claims) {
                    if (roleURI.equals(c.getClaimType())) {
                        Object oValue = c.getValue();
                        if (oValue instanceof String) {
                            if (delim == null) {
View Full Code Here


                claims = parseClaimsInAssertion(assertion.getSaml1());
                audience = getAudienceRestriction(assertion.getSaml1());
            }

            List<String> roles = null;
            FederationProtocol fp = (FederationProtocol)config.getProtocol();
            if (fp.getRoleURI() != null) {
                URI roleURI = URI.create(fp.getRoleURI());
                String delim = fp.getRoleDelimiter();
                for (Claim c : claims) {
                    if (roleURI.equals(c.getClaimType())) {
                        Object oValue = c.getValue();
                        if (oValue instanceof String) {
                            if (delim == null) {
View Full Code Here

                claims = parseClaimsInAssertion(assertion.getSaml1());
                audience = getAudienceRestriction(assertion.getSaml1());
            }

            List<String> roles = null;
            FederationProtocol fp = (FederationProtocol)config.getProtocol();
            if (fp.getRoleURI() != null) {
                URI roleURI = URI.create(fp.getRoleURI());
                String delim = fp.getRoleDelimiter();
                for (Claim c : claims) {
                    URI claimURI = URI.create(c.getNamespace() + "/"
                            + c.getClaimType());
                    if (roleURI.equals(claimURI)) {
                        Object oValue = c.getValue();
View Full Code Here

        wfReq.setWa(FederationConstants.ACTION_SIGNIN);
        wfReq.setWresult(rstr);
       
        configurator = null;
        FederationContext config = getFederationConfigurator().getFederationContext("ROOT");
        FederationProtocol fp = (FederationProtocol)config.getProtocol();
        fp.setRoleDelimiter(",");

        FederationProcessor wfProc = new FederationProcessorImpl();
        FederationResponse wfRes = wfProc.processRequest(wfReq, config);
       
        Assert.assertEquals("Principal name wrong", TEST_USER,
View Full Code Here

        wfReq.setWa(FederationConstants.ACTION_SIGNIN);
        wfReq.setWresult(rstr);
       
        configurator = null;
        FederationContext config = getFederationConfigurator().getFederationContext("CUSTTOK");
        FederationProtocol fp = (FederationProtocol)config.getProtocol();
        List<TokenValidator> validators = fp.getTokenValidators();
        Assert.assertEquals("Two validators must be found", 2, validators.size());
        Assert.assertEquals("First validator must be custom validator",
                            CustomValidator.class.getName(), validators.get(0).getClass().getName());
       
        FederationProcessor wfProc = new FederationProcessorImpl();
View Full Code Here

            sb.append('&').append(FederationConstants.PARAM_REPLY).append('=');
            sb.append(URLEncoder.encode(request.getRequestURL().toString(), "UTF-8"));

            String realm = null;
            FederationProtocol fp = null;
            if (config.getProtocol() instanceof FederationProtocol) {
                fp = (FederationProtocol)config.getProtocol();
            } else {
                LOG.error("Unsupported protocol");
                throw new IllegalStateException("Unsupported protocol");
            }
            if (fp.getRealm() != null) {
                realm = fp.getRealm();
            } else {
                String contextPath = request.getContextPath();
                String requestUrl = request.getRequestURL().toString();
                String requestPath = new URL(requestUrl).getPath();
                // Cut request path of request url and add context path if not ROOT
View Full Code Here

                claims = parseClaimsInAssertion(assertion.getSaml1());
                audience = getAudienceRestriction(assertion.getSaml1());
            }

            List<String> roles = null;
            FederationProtocol fp = (FederationProtocol)config.getProtocol();
            if (fp.getRoleURI() != null) {
                URI roleURI = URI.create(fp.getRoleURI());
                String delim = fp.getRoleDelimiter();
                for (Claim c : claims) {
                    if (roleURI.equals(c.getClaimType())) {
                        Object oValue = c.getValue();
                        if ((oValue instanceof String) && !"".equals((String)oValue)) {
                            if (delim == null) {
View Full Code Here

        wfReq.setWa(FederationConstants.ACTION_SIGNIN);
        wfReq.setWresult(rstr);
       
        configurator = null;
        FederationContext config = getFederationConfigurator().getFederationContext("ROOT");
        FederationProtocol fp = (FederationProtocol)config.getProtocol();
        fp.setRoleDelimiter(",");

        FederationProcessor wfProc = new FederationProcessorImpl();
        FederationResponse wfRes = wfProc.processRequest(wfReq, config);
       
        Assert.assertEquals("Principal name wrong", TEST_USER,
View Full Code Here

        wfReq.setWa(FederationConstants.ACTION_SIGNIN);
        wfReq.setWresult(rstr);
       
        configurator = null;
        FederationContext config = getFederationConfigurator().getFederationContext("CUSTTOK");
        FederationProtocol fp = (FederationProtocol)config.getProtocol();
        List<TokenValidator> validators = fp.getTokenValidators();
        Assert.assertEquals("Two validators must be found", 2, validators.size());
        Assert.assertEquals("First validator must be custom validator",
                            CustomValidator.class.getName(), validators.get(0).getClass().getName());
       
        FederationProcessor wfProc = new FederationProcessorImpl();
View Full Code Here

            writer.writeStartElement("fed", "TargetScope", WS_FEDERATION_NS);
            writer.writeStartElement("wsa", "EndpointReference", WS_ADDRESSING_NS);
            writer.writeStartElement("wsa", "Address", WS_ADDRESSING_NS);

            if (protocol instanceof FederationProtocol) {
                FederationProtocol fedprotocol = (FederationProtocol)protocol;
                String realm = fedprotocol.getRealm();
                if (!(realm == null || "".equals(realm))) {
                    writer.writeCharacters(realm);
                }
            }
            // writer.writeCharacters("http://host:port/url from config");
            writer.writeEndElement(); // Address
            writer.writeEndElement(); // EndpointReference
            writer.writeEndElement(); // TargetScope

            // TODO loop over Context config and populate claims from there instead the dummy code below

            if (protocol instanceof FederationProtocol) {
                FederationProtocol fedprotocol = (FederationProtocol)protocol;
                List<Claim> claims = fedprotocol.getClaimTypesRequested();
                if (claims != null && claims.size() > 0) {

                    // create ClaimsType section
                    writer.writeStartElement("fed", "ClaimTypesRequested", WS_FEDERATION_NS);
                    for (Claim claim : claims) {

                        writer.writeStartElement("auth", "ClaimType", WS_FEDERATION_NS);
                        writer.writeAttribute("Uri", claim.getType());
                        if (claim.isOptional()) {
                            writer.writeAttribute("Optional", "true");
                        } else {
                            writer.writeAttribute("Optional", "false");
                        }

                        writer.writeEndElement(); // ClaimType

                    }
                    writer.writeEndElement(); // ClaimsTypeRequested
                }
            }
            // create sign in endpoint section

            writer.writeStartElement("fed", "PassiveRequestorEndpoint", WS_FEDERATION_NS);
            writer.writeStartElement("wsa", "EndpointReference", WS_ADDRESSING_NS);
            writer.writeStartElement("wsa", "Address", WS_ADDRESSING_NS);

            if (protocol instanceof FederationProtocol) {
                FederationProtocol fedprotocol = (FederationProtocol)protocol;
                Object issuer = fedprotocol.getIssuer();
                if (issuer instanceof String && !"".equals(issuer)) {
                    writer.writeCharacters((String)issuer);
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.cxf.fediz.core.config.FederationProtocol

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.