Package org.picketlink.identity.federation.core.config

Examples of org.picketlink.identity.federation.core.config.SPType


     * @param entityDescriptor
     * @param bindingURI
     * @return
     */
    public static ProviderType getSPConfiguration(EntityDescriptorType entityDescriptor, String bindingURI) {
        SPType spType = new SPType();
        String identityURL = null;
        String serviceURL = null;

        if (identityURL == null) {
            IDPSSODescriptorType idpSSO = getIDPDescriptor(entityDescriptor);
            if (idpSSO != null) {
                identityURL = getIdentityURL(idpSSO, bindingURI);
                spType.setIdentityURL(identityURL);
                spType.setLogoutUrl(getLogoutURL(idpSSO, bindingURI));
                spType.setLogoutResponseLocation(getLogoutResponseLocation(idpSSO, bindingURI));
            }
        }
        if (serviceURL == null) {
            SPSSODescriptorType spSSO = getSPDescriptor(entityDescriptor);
            if (spSSO != null) {
                serviceURL = getServiceURL(spSSO, bindingURI);
            }
            spType.setServiceURL(serviceURL);
        }
        return spType;
    }
View Full Code Here


     * @return
     * @throws ConfigurationException
     */
    public static SPType getSPConfiguration(EntitiesDescriptorType entitiesDescriptor, String bindingURI)
            throws ConfigurationException {
        SPType spType = new SPType();

        List<Object> list = entitiesDescriptor.getEntityDescriptor();

        IDPSSODescriptorType idpSSO = null;
        SPSSODescriptorType spSSO = null;

        if (list != null) {
            for (Object theObject : list) {
                if (theObject instanceof EntitiesDescriptorType) {
                    spType = getSPConfiguration((EntitiesDescriptorType) theObject, bindingURI);
                } else if (theObject instanceof EntityDescriptorType) {
                    if (idpSSO == null) {
                        // Ideally we should lookup the IDP metadata considering the specs. For now the IDP metadata must be
                        // defined within the SP metadata file.
                        idpSSO = getIDPDescriptor((EntityDescriptorType) theObject);
                    }

                    if (spSSO == null) {
                        spSSO = getSPDescriptor((EntityDescriptorType) theObject);
                    }
                }
            }

            if (idpSSO == null) {
                throw logger.samlMetaDataNoIdentityProviderDefined();
            }

            if (spSSO == null) {
                throw logger.samlMetaDataNoServiceProviderDefined();
            }

            String identityURL = getIdentityURL(idpSSO, bindingURI);

            if (identityURL == null) {
                throw logger.samlMetaDataNoIdentityProviderDefined();
            }

            spType.setIdentityURL(identityURL);
            spType.setLogoutUrl(getLogoutURL(idpSSO, bindingURI));
            spType.setLogoutResponseLocation(getLogoutResponseLocation(idpSSO, bindingURI));

            String serviceURL = getServiceURL(spSSO, bindingURI);

            if (serviceURL == null) {
                throw logger.samlMetaDataNoServiceProviderDefined();
            }

            spType.setServiceURL(serviceURL);
        }

        return spType;
    }
View Full Code Here

    /**
     * @see SAMLConfigurationProvider#getSPConfiguration()
     */
    public SPType getSPConfiguration() throws ProcessingException {
        SPType spType = null;
        if (fileAvailable()) {
            try {
                Object metadata = parseMDFile();
                if (metadata instanceof EntitiesDescriptorType) {
                    EntitiesDescriptorType entities = (EntitiesDescriptorType) metadata;
                    spType = CoreConfigUtil.getSPConfiguration(entities, bindingURI);
                } else if (metadata instanceof EntityDescriptorType) {
                    EntityDescriptorType entity = (EntityDescriptorType) metadata;
                    spType = (SPType) CoreConfigUtil.getSPConfiguration(entity, bindingURI);
                } else {
                    throw logger.wrongMetadataRootElement();
                }
            } catch (ParsingException e) {
                throw logger.processingError(e);
            } catch (ConfigurationException e) {
                throw logger.processingError(e);
            }
        } else {
            throw logger.nullValueError(SP_MD_FILE);
        }
       
        if (configParsedSPType != null) {
            spType.importFrom(configParsedSPType);
        }
        return spType;
    }
View Full Code Here

        try {
            props.load(is);
        } catch (IOException e) {
            throw logger.processingError(e);
        }
        SPType sp = new SPType();
        sp.setIdentityURL(props.getProperty("idp.url"));
        sp.setServiceURL("service.url");
        String domains = props.getProperty("domains");
        if (StringUtil.isNotNull(domains)) {
            TrustType trustType = new TrustType();
            trustType.setDomains(domains);
            sp.setTrust(trustType);
        }

        return sp;
    }
View Full Code Here

    /**
     * @see SAMLConfigurationProvider#getSPConfiguration()
     */
    public SPType getSPConfiguration() throws ProcessingException {
        SPType spType = null;
        if (fileAvailable()) {
            try {
                EntitiesDescriptorType entities = parseMDFile();
                spType = CoreConfigUtil.getSPConfiguration(entities, bindingURI);
            } catch (ParsingException e) {
                throw logger.processingError(e);
            } catch (ConfigurationException ce) {
                throw logger.processingError(ce);
            }
        }
        if (configParsedSPType != null) {
            spType.importFrom(configParsedSPType);
        }
        return spType;
    }
View Full Code Here

     * @return
     */
    private ServiceProviderAuthenticator createSPAuthenticator(boolean supportsSignatures) throws Exception {
        ServiceProviderAuthenticator spAuthenticator = new ServiceProviderAuthenticator();

        SPType spType = new SPType();

        spType.setBindingType("POST");
        spType.setIdentityURL("http://localhost/idp");
        spType.setSupportsSignature(supportsSignatures);

        spType.setServiceURL("http://localhost/sp");

        spAuthenticator.setConfigProvider(new MockSAMLConfigurationProvider(spType));

        spAuthenticator.setContainer(this.spContext);

View Full Code Here

    @Test
    public void test03() throws Exception {
        Object object = this.unmarshall(config + "3.xml");
        assertNotNull("SP is null", object);

        SPType sp = (SPType) object;
        assertEquals("http://localhost:8080/idp", sp.getIdentityURL());
        assertEquals("http://localhost:8080/sales", sp.getServiceURL());
        assertEquals(CanonicalizationMethod.EXCLUSIVE, sp.getCanonicalizationMethod());
    }
View Full Code Here

        InputStream configStream = tcl.getResourceAsStream("parser/config/picketlink-sp.xml");
        PicketLinkConfigParser parser = new PicketLinkConfigParser();
        Object result = parser.parse(configStream);
        assertNotNull(result);
        PicketLinkType picketlink = (PicketLinkType) result;
        SPType sp = (SPType) picketlink.getIdpOrSP();
        assertNotNull(sp);
        assertEquals("REDIRECT", sp.getBindingType());
        assertEquals("tomcat", sp.getServerEnvironment());
        assertEquals("someURL", sp.getRelayState());
        assertEquals("/someerror.jsp", sp.getErrorPage());
        assertEquals("/customLogoutPage.jsp", sp.getLogOutPage());
        assertTrue(sp.isSupportsSignature());
        assertTrue(picketlink.isEnableAudit());
    }
View Full Code Here

        SAML2HandlerChainConfig chainConfig = new DefaultSAML2HandlerChainConfig();
        SAML2HandlerConfig handlerConfig = new DefaultSAML2HandlerConfig();

        Map<String, Object> chainOptions = new HashMap<String, Object>();
        ProviderType spType = new SPType();
        chainOptions.put(GeneralConstants.CONFIGURATION, spType);
        chainConfig.set(chainOptions);

        // Initialize the handler
        handler.initChainConfig(chainConfig);
View Full Code Here

        SAML2HandlerConfig handlerConfig = new DefaultSAML2HandlerConfig();
        handlerConfig.addParameter(GeneralConstants.NAMEID_FORMAT, JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get());
        handlerConfig.addParameter(SAML2Handler.DISABLE_SENDING_ROLES, "true");

        Map<String, Object> chainOptions = new HashMap<String, Object>();
        ProviderType spType = new SPType();
        chainOptions.put(GeneralConstants.CONFIGURATION, spType);
        chainOptions.put(GeneralConstants.ROLE_VALIDATOR_IGNORE, "true");
        chainConfig.set(chainOptions);

        // Initialize the handlers
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.config.SPType

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.