Package org.picketlink.identity.federation.core.wstrust

Examples of org.picketlink.identity.federation.core.wstrust.STSConfiguration


        try {

            logger.trace("[InstallDefaultConfiguration] Configuration file name=" + fileName);

            STSConfiguration config = getConfiguration(fileName);
            configuration.copy(config);
        } catch (ConfigurationException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


                }
            }

            InputStream stream = configurationFileURL.openStream();
            STSType stsConfig = (STSType) new STSConfigParser().parse(stream);
            STSConfiguration configuration = new PicketLinkSTSConfiguration(stsConfig);

            logger.stsConfigurationFileLoaded(fileName);
           
            return configuration;
        } catch (Exception e) {
View Full Code Here

        InputStream configStream = cl.getResourceAsStream("sts/picketlink-sts.xml");
        STSConfigParser configParser = new STSConfigParser();
        STSType stsType = (STSType) configParser.parse(configStream);

        STSConfiguration config = new PicketLinkSTSConfiguration(stsType);
        WSTrustServiceFactory factory = WSTrustServiceFactory.getInstance();

        // tests the creation of the request handler.
        WSTrustRequestHandler handler = factory.createRequestHandler(
                "org.picketlink.identity.federation.core.wstrust.StandardRequestHandler", config);
View Full Code Here

     * @throws Exception if an error occurs while running the test.
     */
    @Test
    public void testSTSConfiguration() throws Exception {
        // make the STS read the configuration file.
        STSConfiguration config = this.tokenService.getConfiguration();

        // check the values that have been configured.
        assertEquals("Unexpected service name", "Test STS", config.getSTSName());
        assertEquals("Unexpected token timeout value", 7200 * 1000, config.getIssuedTokenTimeout());
        assertFalse("Encrypt token should be true", config.encryptIssuedToken());
        WSTrustRequestHandler handler = config.getRequestHandler();
        assertNotNull("Unexpected null request handler found", handler);
        assertTrue("Unexpected request handler type", handler instanceof StandardRequestHandler);

        // check the token type -> token provider mapping.
        SecurityTokenProvider provider = config.getProviderForTokenType("http://www.tokens.org/SpecialToken");
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SpecialTokenProvider);
        Map<String, String> properties = ((SpecialTokenProvider) provider).getProperties();
        assertNotNull("Unexpected null properties map", properties);
        assertEquals("Invalid property found", "Value1", properties.get("Property1"));
        assertEquals("Invalid property found", "Value2", properties.get("Property2"));
        provider = config.getProviderForTokenType(SAMLUtil.SAML2_TOKEN_TYPE);
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SAML20TokenProvider);
        provider = config.getProviderForTokenType(SAMLUtil.SAML11_TOKEN_TYPE);
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SAML11TokenProvider);
        assertNull(config.getProviderForTokenType("unexistentType"));

        // check the service provider -> token provider mapping.
        provider = config.getProviderForService("http://services.testcorp.org/provider1");
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SpecialTokenProvider);
        provider = config.getProviderForService("http://services.testcorp.org/provider2");
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SAML20TokenProvider);
        assertNull(config.getProviderForService("http://invalid.service/service"));

        String family = SecurityTokenProvider.FAMILY_TYPE.WS_TRUST.toString();

        // check the token element and namespace -> token provider mapping.
        provider = config.getProviderForTokenElementNS(family, new QName("http://www.tokens.org", "SpecialToken"));
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SpecialTokenProvider);
        provider = config.getProviderForTokenElementNS(family, new QName(JBossSAMLURIConstants.ASSERTION_NSURI.get(),
                JBossSAMLConstants.ASSERTION.get()));
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SAML20TokenProvider);
        provider = config.getProviderForTokenElementNS(family, new QName(SAML11Constants.ASSERTION_11_NSURI,
                JBossSAMLConstants.ASSERTION.get()));
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SAML11TokenProvider);
        assertNull(config.getProviderForTokenElementNS(family, new QName("InvalidNamespace", "SpecialToken")));

        // check the service provider -> token type mapping.
        assertEquals("Invalid token type for service provider 1", "http://www.tokens.org/SpecialToken",
                config.getTokenTypeForService("http://services.testcorp.org/provider1"));
        assertEquals("Invalid token type for service provider 2", SAMLUtil.SAML2_TOKEN_TYPE,
                config.getTokenTypeForService("http://services.testcorp.org/provider2"));
        assertNull(config.getTokenTypeForService("http://invalid.service/service"));

        // check the keystore configuration.
        assertNotNull("Invalid null STS key pair", config.getSTSKeyPair());
        assertNotNull("Invalid null STS public key", config.getSTSKeyPair().getPublic());
        assertNotNull("Invalid null STS private key", config.getSTSKeyPair().getPrivate());
        assertNotNull("Invalid null validating key for service provider 1",
                config.getServiceProviderPublicKey("http://services.testcorp.org/provider1"));
        assertNotNull("Invalid null validating key for service provider 2",
                config.getServiceProviderPublicKey("http://services.testcorp.org/provider2"));
    }
View Full Code Here

     * </p>
     *
     * @throws Exception if an error occurs while running the test.
     */
    public void testCreateRequestHandler() throws Exception {
        STSConfiguration config = new PicketLinkSTSConfiguration();
        WSTrustServiceFactory factory = WSTrustServiceFactory.getInstance();

        // tests the creation of the request handler.
        WSTrustRequestHandler handler = factory.createRequestHandler(
                "org.picketlink.identity.federation.core.wstrust.StandardRequestHandler", config);
View Full Code Here

    @Test
    public void testMaskedPassword() throws Exception {
        PicketLinkSTSUnitTestCase plstsTest = new PicketLinkSTSUnitTestCase();
        TestSTS sts = plstsTest.new TestSTS("sts/picketlink-sts-maskedpasswd.xml");

        STSConfiguration stsConfiguration = sts.getConfiguration();
        Certificate cert = stsConfiguration.getCertificate("service1");
        assertNotNull("cert is not null", cert);

        cert = stsConfiguration.getCertificate("service2");
        assertNotNull("cert is not null", cert);
    }
View Full Code Here

    @Test
    public void testXMLDSigCanonicalization() throws Exception {
        PicketLinkSTSUnitTestCase plstsTest = new PicketLinkSTSUnitTestCase();
        TestSTS sts = plstsTest.new TestSTS("sts/picketlink-sts-xmldsig-Canonicalization.xml");

        STSConfiguration stsConfiguration = sts.getConfiguration();
        assertNotNull("STS Configuration is not null", stsConfiguration);
        assertEquals(CanonicalizationMethod.EXCLUSIVE, stsConfiguration.getXMLDSigCanonicalizationMethod());
    }
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.wstrust.STSConfiguration

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.