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

Examples of org.apache.cxf.fediz.core.config.jaxb.ContextConfig


    //CHECKSTYLE:OFF
    private FedizConfig createConfiguration() throws JAXBException {

        FedizConfig rootConfig = new FedizConfig();
        ContextConfig config = new ContextConfig();
        rootConfig.getContextConfig().add(config);

        config.setName(CONFIG_NAME);
        config.setMaximumClockSkew(new BigInteger(CLOCK_SKEW));

        FederationProtocolType protocol = new FederationProtocolType();
        config.setProtocol(protocol);

        KeyManagersType sigManager = new KeyManagersType();
        sigManager.setKeyPassword(KEY_PASSWORD);
        sigManager.setKeyAlias(KEY_ALIAS);
       
        KeyStoreType sigStore = new KeyStoreType();
        sigStore.setType(JKS_TYPE);
        sigStore.setPassword(KEYSTORE_PASSWORD);//integrity password
        sigStore.setFile(KEYSTORE_FILE);
        sigManager.setKeyStore(sigStore);
       
        config.setSigningKey(sigManager);
       
        TrustedIssuers trustedIssuers = new TrustedIssuers();
            
        TrustedIssuerType trustedIssuer = new TrustedIssuerType();
        trustedIssuer.setCertificateValidation(ValidationType.CHAIN_TRUST);
        trustedIssuer.setName(TRUST_ISSUER_NAME);
        trustedIssuer.setSubject(TRUST_ISSUER_CERT_CONSTRAINT);
        trustedIssuers.getIssuer().add(trustedIssuer);
        config.setTrustedIssuers(trustedIssuers);

        CertificateStores certStores = new CertificateStores();
        TrustManagersType truststore = new TrustManagersType();
       
        KeyStoreType ks1 = new KeyStoreType();
        ks1.setType(JKS_TYPE);
        ks1.setPassword(KEYSTORE_PASSWORD);
        ks1.setFile(KEYSTORE_FILE);
        truststore.setKeyStore(ks1);
        certStores.getTrustManager().add(truststore);
        config.setCertificateStores(certStores);

        CallbackType authType = new CallbackType();
        authType.setType(ArgumentType.STRING);
        authType.setValue(AUTH_TYPE_VALUE);
       
        CallbackType tokenRequest = new CallbackType();
        tokenRequest.setType(ArgumentType.STRING);
        tokenRequest.setValue(TEST_WREQ);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add(AUDIENCE_URI_1);
        config.setAudienceUris(audienceUris);

        protocol.setAuthenticationType(authType);
        protocol.setRequest(tokenRequest);
        protocol.setRoleDelimiter(ROLE_DELIMITER);
        protocol.setRoleURI(ROLE_URI);
View Full Code Here


        StringWriter writer = new StringWriter();
        jaxbContext.createMarshaller().marshal(configOut, writer);
        StringReader reader = new StringReader(writer.toString());
        configurator.loadConfig(reader);

        ContextConfig config = configurator.getContextConfig(CONFIG_NAME);
        Assert.assertNotNull(config);
        AudienceUris audience = config.getAudienceUris();
        Assert.assertEquals(1, audience.getAudienceItem().size());
        Assert.assertTrue(config.getProtocol() instanceof FederationProtocolType);
        FederationProtocolType fp = (FederationProtocolType)config.getProtocol();

        Assert.assertEquals(HOME_REALM_CLASS, fp.getHomeRealm().getValue());
        //Assert.assertEquals(config.getCertificateValidation(),ValidationType.CHAIN_TRUST);
       
        /**
 
View Full Code Here

    }
   
    private FedizConfig createConfiguration() throws JAXBException {

        FedizConfig rootConfig = new FedizConfig();
        ContextConfig config = new ContextConfig();
        rootConfig.getContextConfig().add(config);

        config.setName(CONFIG_NAME);
        config.setMaximumClockSkew(new BigInteger(CLOCK_SKEW));

        CertificateStores certStores = new CertificateStores();
       
        TrustManagersType tm0 = new TrustManagersType();      
        KeyStoreType ks0 = new KeyStoreType();
        ks0.setType("JKS");
        ks0.setPassword(KEYSTORE_PASSWORD);
        ks0.setResource(KEYSTORE_RESOURCE_PATH);
        tm0.setKeyStore(ks0);
        certStores.getTrustManager().add(tm0);   
        config.setCertificateStores(certStores);
       
        TrustedIssuers trustedIssuers = new TrustedIssuers();
        TrustedIssuerType ti0 = new TrustedIssuerType();
        ti0.setCertificateValidation(ValidationType.CHAIN_TRUST);
        ti0.setName("issuer1");
        ti0.setSubject(SUBJECT_VALUE);
        trustedIssuers.getIssuer().add(ti0);
        config.setTrustedIssuers(trustedIssuers);

        FederationProtocolType protocol = new FederationProtocolType();
        config.setProtocol(protocol);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add(AUDIENCE_URI);
        config.setAudienceUris(audienceUris);

        protocol.setRoleDelimiter(ROLE_DELIMITER);
        protocol.setRoleURI(ROLE_URI);

        ClaimTypesRequested claimTypeReq = new ClaimTypesRequested();
View Full Code Here

    }
   
    private FedizConfig createConfiguration() throws JAXBException {

        FedizConfig rootConfig = new FedizConfig();
        ContextConfig config = new ContextConfig();
        rootConfig.getContextConfig().add(config);

        config.setName(CONFIG_NAME);
        config.setMaximumClockSkew(new BigInteger(CLOCK_SKEW));

        CertificateStores certStores = new CertificateStores();
       
        TrustManagersType tm0 = new TrustManagersType();      
        KeyStoreType ks0 = new KeyStoreType();
        ks0.setType("JKS");
        ks0.setPassword(KEYSTORE_PASSWORD);
        ks0.setResource(KEYSTORE_RESOURCE_PATH);
        tm0.setKeyStore(ks0);
        certStores.getTrustManager().add(tm0);   
        config.setCertificateStores(certStores);
       
        TrustedIssuers trustedIssuers = new TrustedIssuers();
        TrustedIssuerType ti0 = new TrustedIssuerType();
        ti0.setCertificateValidation(ValidationType.CHAIN_TRUST);
        ti0.setName("issuer1");
        ti0.setSubject(SUBJECT_VALUE);
        trustedIssuers.getIssuer().add(ti0);
        config.setTrustedIssuers(trustedIssuers);

        FederationProtocolType protocol = new FederationProtocolType();
        config.setProtocol(protocol);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add(AUDIENCE_URI);
        config.setAudienceUris(audienceUris);

        protocol.setRoleDelimiter(ROLE_DELIMITER);
        protocol.setRoleURI(ROLE_URI);

        ClaimTypesRequested claimTypeReq = new ClaimTypesRequested();
View Full Code Here

    //CHECKSTYLE:OFF
    private FedizConfig createConfiguration() throws JAXBException {

        FedizConfig rootConfig = new FedizConfig();
        ContextConfig config = new ContextConfig();
        rootConfig.getContextConfig().add(config);

        config.setName(CONFIG_NAME);
        config.setMaximumClockSkew(new BigInteger(CLOCK_SKEW));

        FederationProtocolType protocol = new FederationProtocolType();
        config.setProtocol(protocol);

        KeyManagersType sigManager = new KeyManagersType();
        sigManager.setKeyPassword(KEY_PASSWORD);
        sigManager.setKeyAlias(KEY_ALIAS);
       
        KeyStoreType sigStore = new KeyStoreType();
        sigStore.setType(JKS_TYPE);
        sigStore.setPassword(KEYSTORE_PASSWORD);//integrity password
        sigStore.setFile(KEYSTORE_FILE);
        sigManager.setKeyStore(sigStore);
       
        config.setSigningKey(sigManager);
       
        TrustedIssuers trustedIssuers = new TrustedIssuers();
            
        TrustedIssuerType trustedIssuer = new TrustedIssuerType();
        trustedIssuer.setCertificateValidation(ValidationType.CHAIN_TRUST);
        trustedIssuer.setName(TRUST_ISSUER_NAME);
        trustedIssuer.setSubject(TRUST_ISSUER_CERT_CONSTRAINT);
        trustedIssuers.getIssuer().add(trustedIssuer);
        config.setTrustedIssuers(trustedIssuers);

        CertificateStores certStores = new CertificateStores();
        TrustManagersType truststore = new TrustManagersType();
       
        KeyStoreType ks1 = new KeyStoreType();
        ks1.setType(JKS_TYPE);
        ks1.setPassword(KEYSTORE_PASSWORD);
        ks1.setFile(KEYSTORE_FILE);
        truststore.setKeyStore(ks1);
        certStores.getTrustManager().add(truststore);
        config.setCertificateStores(certStores);

        CallbackType authType = new CallbackType();
        authType.setType(ArgumentType.STRING);
        authType.setValue(AUTH_TYPE_VALUE);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add(AUDIENCE_URI_1);
        config.setAudienceUris(audienceUris);

        protocol.setAuthenticationType(authType);
        protocol.setRoleDelimiter(ROLE_DELIMITER);
        protocol.setRoleURI(ROLE_URI);
View Full Code Here

        StringWriter writer = new StringWriter();
        jaxbContext.createMarshaller().marshal(configOut, writer);
        StringReader reader = new StringReader(writer.toString());
        configurator.loadConfig(reader);

        ContextConfig config = configurator.getContextConfig(CONFIG_NAME);
        Assert.assertNotNull(config);
        AudienceUris audience = config.getAudienceUris();
        Assert.assertEquals(1, audience.getAudienceItem().size());
        Assert.assertTrue(config.getProtocol() instanceof FederationProtocolType);
        FederationProtocolType fp = (FederationProtocolType)config.getProtocol();

        Assert.assertEquals(HOME_REALM_CLASS, fp.getHomeRealm().getValue());
        //Assert.assertEquals(config.getCertificateValidation(),ValidationType.CHAIN_TRUST);
       
        /**
 
View Full Code Here

    //CHECKSTYLE:OFF
    private FedizConfig createConfiguration() throws JAXBException {

        FedizConfig rootConfig = new FedizConfig();
        ContextConfig config = new ContextConfig();
        rootConfig.getContextConfig().add(config);

        config.setName(CONFIG_NAME);
        config.setMaximumClockSkew(new BigInteger(CLOCK_SKEW));

        CertificateStores certStores = new CertificateStores();
       
        TrustManagersType tm0 = new TrustManagersType();      
        KeyStoreType ks0 = new KeyStoreType();
        ks0.setType("JKS");
        ks0.setPassword(KEYSTORE_PASSWORD_1);
        ks0.setResource(KEYSTORE_RESOURCE_PATH_1);
        tm0.setKeyStore(ks0);
       
        certStores.getTrustManager().add(tm0);
       
        TrustManagersType tm1 = new TrustManagersType();
        KeyStoreType ks1 = new KeyStoreType();
        ks1.setType("JKS");
        ks1.setPassword(KEYSTORE_PASSWORD_2);
        ks1.setResource(KEYSTORE_RESOURCE_PATH_2);
        tm1.setKeyStore(ks1);
       
        certStores.getTrustManager().add(tm1);
       
        TrustManagersType tm2 = new TrustManagersType();
        KeyStoreType ks2 = new KeyStoreType();
        ks2.setType("JKS");
        ks2.setPassword(KEYSTORE_PASSWORD_3);
        ks2.setResource(KEYSTORE_RESOURCE_PATH_3);
        tm2.setKeyStore(ks2);
       
        certStores.getTrustManager().add(tm2);
       
        config.setCertificateStores(certStores);
       
        TrustedIssuers trustedIssuers = new TrustedIssuers();
       
        TrustedIssuerType ti0 = new TrustedIssuerType();
        ti0.setCertificateValidation(ValidationType.CHAIN_TRUST);
        ti0.setName("issuer1");
        ti0.setSubject(SUBJECT_VALUE_1);
        trustedIssuers.getIssuer().add(ti0);
       
        TrustedIssuerType ti1 = new TrustedIssuerType();
        ti1.setCertificateValidation(ValidationType.CHAIN_TRUST);
        ti1.setName("issuer1");
        ti1.setSubject(SUBJECT_VALUE_2);
        trustedIssuers.getIssuer().add(ti1);
       
        TrustedIssuerType ti2 = new TrustedIssuerType();
        ti2.setCertificateValidation(ValidationType.CHAIN_TRUST);
        ti2.setName("issuer1");
        ti2.setSubject(SUBJECT_VALUE_3);
        trustedIssuers.getIssuer().add(ti2);
       
        config.setTrustedIssuers(trustedIssuers);

        FederationProtocolType protocol = new FederationProtocolType();
        config.setProtocol(protocol);

        CallbackType authType = new CallbackType();
        authType.setType(ArgumentType.STRING);
        authType.setValue(AUTH_TYPE_VALUE);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add(AUDIENCE_URI_1);
        audienceUris.getAudienceItem().add(AUDIENCE_URI_2);
        audienceUris.getAudienceItem().add(AUDIENCE_URI_3);
        config.setAudienceUris(audienceUris);

        protocol.setAuthenticationType(authType);
        protocol.setRoleDelimiter(ROLE_DELIMITER);
        protocol.setRoleURI(ROLE_URI);
View Full Code Here

        StringWriter writer = new StringWriter();
        jaxbContext.createMarshaller().marshal(configOut, writer);
        StringReader reader = new StringReader(writer.toString());
        configurator.loadConfig(reader);

        ContextConfig config = configurator.getContextConfig(CONFIG_NAME);
        Assert.assertNotNull(config);
        AudienceUris audience = config.getAudienceUris();
        Assert.assertEquals(3, audience.getAudienceItem().size());
        Assert.assertTrue(config.getProtocol() instanceof FederationProtocolType);
        FederationProtocolType fp = (FederationProtocolType) config
                .getProtocol();

        Assert.assertEquals(HOME_REALM_CLASS, fp.getHomeRealm().getValue());

    }
View Full Code Here

        TokenReplayCache<String> defaultReplayCache = parseConfigAndReturnTokenReplayCache(config);
        Assert.assertNotNull(defaultReplayCache);
        Assert.assertTrue(defaultReplayCache instanceof EHCacheTokenReplayCache);
       
        // Now test setting another TokenReplayCache
        ContextConfig contextConfig = config.getContextConfig().get(0);
        contextConfig.setTokenReplayCache("org.apache.cxf.fediz.core.InMemoryTokenReplayCache");
       
        TokenReplayCache<String> newReplayCache = parseConfigAndReturnTokenReplayCache(config);
        Assert.assertNotNull(newReplayCache);
        Assert.assertTrue(newReplayCache instanceof InMemoryTokenReplayCache);
       
        // Now test setting another TokenReplayCache
        contextConfig.setTokenReplayCache("org.apache.cxf.fediz.core.EHCacheTokenReplayCache");
       
        newReplayCache = parseConfigAndReturnTokenReplayCache(config);
        Assert.assertNotNull(newReplayCache);
        Assert.assertTrue(newReplayCache instanceof EHCacheTokenReplayCache);
    }
View Full Code Here

    }
   
    @org.junit.Test
    public void validateSAML2TokenWithConfigCreatedWithAPI() throws Exception {
       
        ContextConfig config = new ContextConfig();
       
        config.setName("whatever");

        // Configure certificate store
        CertificateStores certStores = new CertificateStores();
        TrustManagersType tm0 = new TrustManagersType();      
        KeyStoreType ks0 = new KeyStoreType();
        ks0.setType("JKS");
        ks0.setPassword("storepass");
        ks0.setFile("ststrust.jks");
        tm0.setKeyStore(ks0);
        certStores.getTrustManager().add(tm0);
        config.setCertificateStores(certStores);
       
        // Configure trusted IDP
        TrustedIssuers trustedIssuers = new TrustedIssuers();
        TrustedIssuerType ti0 = new TrustedIssuerType();
        ti0.setCertificateValidation(ValidationType.CHAIN_TRUST);
        ti0.setName("FedizSTSIssuer");
        ti0.setSubject(".*CN=www.sts.com.*");
        trustedIssuers.getIssuer().add(ti0);
        config.setTrustedIssuers(trustedIssuers);

        FederationProtocolType protocol = new FederationProtocolType();
        config.setProtocol(protocol);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add("https://localhost/fedizhelloworld");
        config.setAudienceUris(audienceUris);

        protocol.setRoleURI("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role");

        FederationContext fedContext = new FederationContext(config);
        fedContext.init();
View Full Code Here

TOP

Related Classes of org.apache.cxf.fediz.core.config.jaxb.ContextConfig

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.