Package org.picketlink.identity.federation.core.interfaces

Examples of org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider


                for (KeyValueType propertyType : providerPropertiesList) {
                    properties.put(propertyType.getKey(), propertyType.getValue());
                }

                // create and initialize the token provider.
                SecurityTokenProvider tokenProvider = WSTrustServiceFactory.getInstance().createTokenProvider(
                        provider.getProviderClass(), properties);
                // token providers can be keyed by the token type and by token element + namespace.
                this.tokenProviders.put(provider.getTokenType(), tokenProvider);
                String tokenElementAndNS = tokenProvider.family() + "$" + provider.getTokenElement() + "$"
                        + provider.getTokenElementNS();
                this.tokenProviders.put(tokenElementAndNS, tokenProvider);
            }
        }
View Full Code Here


    public SecurityTokenProvider createTokenProvider(String providerClass, Map<String, String> properties) {
        try {
            Class<?> clazz = SecurityActions.loadClass(getClass(), providerClass);
            if (clazz == null)
                throw logger.classNotLoadedError(providerClass);
            SecurityTokenProvider tokenProvider = (SecurityTokenProvider) clazz.newInstance();
            tokenProvider.initialize(properties);
            return tokenProvider;
        } catch (Exception pae) {
            throw new RuntimeException(logger.couldNotCreateInstance(providerClass, pae));
        }
    }
View Full Code Here

    public void issueToken(ProtocolContext protocolContext) throws ProcessingException {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null)
            sm.checkPermission(rte);

        SecurityTokenProvider provider = getProvider(protocolContext);

        if (provider == null)
            throw logger.stsNoTokenProviderError(configuration.toString(), protocolContext.toString());

        logger.debug("issueToken::provider=" + provider);

        provider.issueToken(protocolContext);
    }
View Full Code Here

    public void renewToken(ProtocolContext protocolContext) throws ProcessingException {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null)
            sm.checkPermission(rte);

        SecurityTokenProvider provider = null;

        if (provider == null)
            provider = getProviderBasedOnQName(protocolContext);

        if (provider == null)
            throw logger.stsNoTokenProviderError(configuration.toString(), protocolContext.toString());

        logger.debug("renewToken::provider=" + provider);

        provider.renewToken(protocolContext);
    }
View Full Code Here

    public void cancelToken(ProtocolContext protocolContext) throws ProcessingException {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null)
            sm.checkPermission(rte);

        SecurityTokenProvider provider = null;

        if (provider == null)
            provider = getProviderBasedOnQName(protocolContext);

        if (provider == null)
            throw logger.stsNoTokenProviderError("", protocolContext.toString());

        logger.debug("cancelToken::provider=" + provider);

        provider.cancelToken(protocolContext);
    }
View Full Code Here

    public void validateToken(ProtocolContext protocolContext) throws ProcessingException {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null)
            sm.checkPermission(rte);

        SecurityTokenProvider provider = null;

        if (provider == null)
            provider = getProviderBasedOnQName(protocolContext);

        if (provider == null)
            throw logger.stsNoTokenProviderError(configuration.toString(), protocolContext.toString());

        logger.debug("validateToken::provider=" + provider);

        provider.validateToken(protocolContext);
    }
View Full Code Here

    private SecurityTokenProvider getProvider(ProtocolContext protocolContext) {
        if (configuration == null)
            throw new RuntimeException(ErrorCodes.STS_CONFIGURATION_NOT_SET);

        SecurityTokenProvider provider = null;

        // Special Case: WST Applies To
        String serviceName = protocolContext.serviceName();
        if (serviceName != null) {
            provider = this.configuration.getProviderForService(serviceName);
View Full Code Here

        }
        return provider;
    }

    private SecurityTokenProvider getProviderBasedOnQName(ProtocolContext protocolContext) throws ProcessingException {
        SecurityTokenProvider provider = null;

        QName qname = null;
        if (provider == null) {
            qname = protocolContext.getQName();
            if (qname == null)
View Full Code Here

        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"));
View Full Code Here

     *
     * @throws Exception if an error occurs while running the test.
     */
    public void testCreateTokenProvider() throws Exception {
        WSTrustServiceFactory factory = WSTrustServiceFactory.getInstance();
        SecurityTokenProvider provider = factory.createTokenProvider(
                "org.picketlink.test.identity.federation.core.wstrust.SpecialTokenProvider", null);
        assertNotNull("Unexpected null token provider", provider);
        assertTrue("Unexpected token provider type", provider instanceof SpecialTokenProvider);
        provider = factory.createTokenProvider(
                "org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider",
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider

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.