Examples of KeyProviderType


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

        IDPType idp = (IDPType) object;
        assertEquals("somefqn", idp.getRoleGenerator());
        assertTrue(idp.isEncrypt());
        assertEquals(CanonicalizationMethod.EXCLUSIVE, idp.getCanonicalizationMethod());
        KeyProviderType kp = idp.getKeyProvider();
        assertNotNull("KeyProvider is not null", kp);
        assertEquals("SomeClass", "SomeClass", kp.getClassName());
        List<AuthPropertyType> authProps = kp.getAuth();
        AuthPropertyType authProp = authProps.get(0);
        assertEquals("SomeKey", "SomeKey", authProp.getKey());
        assertEquals("SomeValue", "SomeValue", authProp.getValue());

        authProp = authProps.get(1);
        assertEquals("DBURL", "DBURL", authProp.getKey());
        assertEquals("SomeDBURL", "SomeDBURL", authProp.getValue());

        List<KeyValueType> validatingAliases = kp.getValidatingAlias();
        assertEquals("Validating Alias length is 2", 2, validatingAliases.size());

        KeyValueType kv = validatingAliases.get(0);
        assertEquals("localhost", kv.getKey());
        assertEquals("localhostalias", kv.getValue());
View Full Code Here

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

        assertEquals(true, stsType.isSignToken());
        assertEquals(false, stsType.isEncryptToken());
        assertEquals("http://www.w3.org/2001/10/xml-exc-c14n#WithComments", stsType.getCanonicalizationMethod());

        // check if the key provider has been set according to the configuration file.
        KeyProviderType keyProvider = stsType.getKeyProvider();
        assertNotNull(keyProvider);
        assertEquals("org.picketlink.identity.federation.core.impl.KeyStoreKeyManager", keyProvider.getClassName());
        assertNull(keyProvider.getSigningAlias());
        List<AuthPropertyType> authProperties = keyProvider.getAuth();
        assertEquals(4, authProperties.size());
        assertEquals("KeyStoreURL", authProperties.get(0).getKey());
        assertEquals("sts_keystore.jks", authProperties.get(0).getValue());
        assertEquals("KeyStorePass", authProperties.get(1).getKey());
        assertEquals("testpass", authProperties.get(1).getValue());
        assertEquals("SigningKeyAlias", authProperties.get(2).getKey());
        assertEquals("sts", authProperties.get(2).getValue());
        assertEquals("SigningKeyPass", authProperties.get(3).getKey());
        assertEquals("keypass", authProperties.get(3).getValue());
        List<KeyValueType> validatingAliases = keyProvider.getValidatingAlias();
        assertEquals(2, validatingAliases.size());
        assertEquals("http://services.testcorp.org/provider1", validatingAliases.get(0).getKey());
        assertEquals("service1", validatingAliases.get(0).getValue());
        assertEquals("http://services.testcorp.org/provider2", validatingAliases.get(1).getKey());
        assertEquals("service2", validatingAliases.get(1).getValue());
View Full Code Here

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

    protected void initKeyProvider(Context context) throws LifecycleException {
        if (!doSupportSignature()) {
            return;
        }

        KeyProviderType keyProvider = this.spConfiguration.getKeyProvider();

        if (keyProvider == null && doSupportSignature())
            throw new LifecycleException(ErrorCodes.NULL_VALUE + "KeyProvider is null for context=" + context.getName());

        try {
            String keyManagerClassName = keyProvider.getClassName();
            if (keyManagerClassName == null)
                throw new RuntimeException(ErrorCodes.NULL_VALUE + "KeyManager class name");

            Class<?> clazz = SecurityActions.loadClass(getClass(), keyManagerClassName);

            if (clazz == null)
                throw new ClassNotFoundException(ErrorCodes.CLASS_NOT_LOADED + keyManagerClassName);
            this.keyManager = (TrustKeyManager) clazz.newInstance();

            List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider);

            keyManager.setAuthProperties(authProperties);
            keyManager.setValidatingAlias(keyProvider.getValidatingAlias());

            String identityURL = this.spConfiguration.getIdentityURL();

            //Special case when you need X509Data in SignedInfo
            if(authProperties != null){
                for(AuthPropertyType authPropertyType: authProperties){
                    String key = authPropertyType.getKey();
                    if(GeneralConstants.X509CERTIFICATE.equals(key)){
                        //we need X509Certificate in SignedInfo. The value is the alias name
                        keyManager.addAdditionalOption(GeneralConstants.X509CERTIFICATE, authPropertyType.getValue());
                        break;
                    }
                }
            }
            keyManager.addAdditionalOption(ServiceProviderBaseProcessor.IDP_KEY, new URL(identityURL).getHost());
        } catch (Exception e) {
            logger.trustKeyManagerCreationError(e);
            throw new LifecycleException(e.getLocalizedMessage());
        }

        logger.trace("Key Provider=" + keyProvider.getClassName());
    }
View Full Code Here

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

        }
    }

    protected void initKeyManager() throws LifecycleException {
        if (this.idpConfiguration.isSupportsSignature() || this.idpConfiguration.isEncrypt()) {
            KeyProviderType keyProvider = this.idpConfiguration.getKeyProvider();
            if (keyProvider == null)
                throw new LifecycleException(
                        logger.nullValueError("Key Provider is null for context=" + getContext().getName()));

            try {
                this.keyManager = CoreConfigUtil.getTrustKeyManager(keyProvider);

                List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider);
                keyManager.setAuthProperties(authProperties);
                keyManager.setValidatingAlias(keyProvider.getValidatingAlias());
                //Special case when you need X509Data in SignedInfo
                if(authProperties != null){
                    for(AuthPropertyType authPropertyType: authProperties){
                        String key = authPropertyType.getKey();
                        if(GeneralConstants.X509CERTIFICATE.equals(key)){
                            //we need X509Certificate in SignedInfo. The value is the alias name
                            keyManager.addAdditionalOption(GeneralConstants.X509CERTIFICATE, authPropertyType.getValue());
                            break;
                        }
                    }
                }
            } catch (Exception e) {
                logger.trustKeyManagerCreationError(e);
                throw new LifecycleException(e.getLocalizedMessage());
            }

            logger.samlIDPSettingCanonicalizationMethod(idpConfiguration.getCanonicalizationMethod());

            XMLSignatureUtil.setCanonicalizationMethodType(idpConfiguration.getCanonicalizationMethod());

            logger.trace("Key Provider=" + keyProvider.getClassName());
        }
    }
View Full Code Here

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

            }

            metadata = (EntityDescriptorType) metadataProvider.getMetaData();

            // Get the trust manager information
            KeyProviderType keyProvider = providerType.getKeyProvider();
            signingAlias = keyProvider.getSigningAlias();
            String keyManagerClassName = keyProvider.getClassName();
            if (keyManagerClassName == null)
                throw new RuntimeException(ErrorCodes.NULL_VALUE + "KeyManager class name");

            clazz = SecurityActions.loadClass(getClass(), keyManagerClassName);
            this.keyManager = (TrustKeyManager) clazz.newInstance();
View Full Code Here

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

        if (ignoreSigString != null && !"".equals(ignoreSigString)) {
            this.ignoreSignatures = Boolean.parseBoolean(ignoreSigString);
        }

        if (ignoreSignatures == false) {
            KeyProviderType keyProvider = this.spConfiguration.getKeyProvider();
            if (keyProvider == null)
                throw new RuntimeException(ErrorCodes.NULL_VALUE + "KeyProvider");
            try {
                String keyManagerClassName = keyProvider.getClassName();
                if (keyManagerClassName == null)
                    throw new RuntimeException(ErrorCodes.NULL_VALUE + "KeyManager class name");

                Class<?> clazz = SecurityActions.loadClass(getClass(), keyManagerClassName);
                this.keyManager = (TrustKeyManager) clazz.newInstance();

                List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider);
                keyManager.setAuthProperties(authProperties);

                keyManager.setValidatingAlias(keyProvider.getValidatingAlias());
            } catch (Exception e) {
                log.error("Exception reading configuration:", e);
                throw new RuntimeException(e.getLocalizedMessage());
            }
            log.trace("Key Provider=" + keyProvider.getClassName());
        }

        // see if a global logout page has been configured
        String gloPage = filterConfig.getInitParameter(GeneralConstants.LOGOUT_PAGE);
        if (gloPage != null && !"".equals(gloPage))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.