Examples of SAMLCallbackHandlerImpl


Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

   
    @Test
    public void testSAMLConfiguration() throws Exception {
        Map<String, Object> config = new HashMap<String, Object>();
        config.put(ConfigurationConstants.ACTION, ConfigurationConstants.SAML_TOKEN_UNSIGNED);
        config.put(ConfigurationConstants.SAML_CALLBACK_REF, new SAMLCallbackHandlerImpl());
       
        WSSSecurityProperties properties = ConfigurationConverter.convert(config);
        Assert.assertEquals(properties.getActions().size(), 1);
        Assert.assertEquals(properties.getActions().get(0), WSSConstants.SAML_TOKEN_UNSIGNED);
        Assert.assertTrue(properties.getSamlCallbackHandler() instanceof SAMLCallbackHandlerImpl);
View Full Code Here

Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

                        "        </wsp:ExactlyOne>";

        WSSSecurityProperties outSecurityProperties = new WSSSecurityProperties();
        WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.USERNAMETOKEN, WSSConstants.SAML_TOKEN_SIGNED, WSSConstants.ENCRYPT_WITH_DERIVED_KEY};
        outSecurityProperties.setOutAction(actions);
        SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
        samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
        samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
        samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
        samlCallbackHandler.setIssuer("www.example.com");
        byte[] secret = new byte[128 / 8];
        WSSConstants.secureRandom.nextBytes(secret);
        CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
        callbackHandler.setSecret(secret);
        KeyStore keyStore = KeyStore.getInstance("jks");
        keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
        Merlin crypto = new Merlin();
        crypto.setKeyStore(keyStore);
        CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
        cryptoType.setAlias("transmitter");
        samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
        outSecurityProperties.setCallbackHandler(callbackHandler);
        outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
        outSecurityProperties.setTokenUser("tester");
        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
        outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
View Full Code Here

Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

                        "        </wsp:ExactlyOne>";

        WSSSecurityProperties outSecurityProperties = new WSSSecurityProperties();
        WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.USERNAMETOKEN, WSSConstants.SAML_TOKEN_SIGNED, WSSConstants.ENCRYPT_WITH_DERIVED_KEY};
        outSecurityProperties.setOutAction(actions);
        SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
        samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
        samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
        samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
        samlCallbackHandler.setIssuer("www.example.com");
        byte[] secret = new byte[128 / 8];
        WSSConstants.secureRandom.nextBytes(secret);
        CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
        callbackHandler.setSecret(secret);
        KeyStore keyStore = KeyStore.getInstance("jks");
        keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
        Merlin crypto = new Merlin();
        crypto.setKeyStore(keyStore);
        CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
        cryptoType.setAlias("transmitter");
        samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
        outSecurityProperties.setCallbackHandler(callbackHandler);
        outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
        outSecurityProperties.setTokenUser("tester");
        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
        outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
View Full Code Here

Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

   
    @Test
    public void testSAMLConfiguration() throws Exception {
        Map<String, Object> config = new HashMap<String, Object>();
        config.put(ConfigurationConstants.ACTION, ConfigurationConstants.SAML_TOKEN_UNSIGNED);
        config.put(ConfigurationConstants.SAML_CALLBACK_REF, new SAMLCallbackHandlerImpl());
       
        WSSSecurityProperties properties = ConfigurationConverter.convert(config);
        Assert.assertEquals(properties.getOutAction()[0], WSSConstants.SAML_TOKEN_UNSIGNED);
        Assert.assertTrue(properties.getSamlCallbackHandler() instanceof SAMLCallbackHandlerImpl);
       
View Full Code Here

Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

        actions.add(WSSConstants.TIMESTAMP);
        actions.add(WSSConstants.USERNAMETOKEN);
        actions.add(WSSConstants.SAML_TOKEN_SIGNED);
        actions.add(WSSConstants.ENCRYPT_WITH_DERIVED_KEY);
        outSecurityProperties.setActions(actions);
        SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
        samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
        samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
        samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
        samlCallbackHandler.setIssuer("www.example.com");
        byte[] secret = WSSConstants.generateBytes(128 / 8);
        CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
        callbackHandler.setSecret(secret);
        KeyStore keyStore = KeyStore.getInstance("jks");
        keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
        Merlin crypto = new Merlin();
        crypto.setKeyStore(keyStore);
        CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
        cryptoType.setAlias("transmitter");
        samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
        outSecurityProperties.setCallbackHandler(callbackHandler);
        outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
        outSecurityProperties.setTokenUser("tester");
        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
        outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
View Full Code Here

Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

        actions.add(WSSConstants.TIMESTAMP);
        actions.add(WSSConstants.USERNAMETOKEN);
        actions.add(WSSConstants.SAML_TOKEN_SIGNED);
        actions.add(WSSConstants.ENCRYPT_WITH_DERIVED_KEY);
        outSecurityProperties.setActions(actions);
        SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
        samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
        samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
        samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
        samlCallbackHandler.setIssuer("www.example.com");
        byte[] secret = WSSConstants.generateBytes(128 / 8);
        CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
        callbackHandler.setSecret(secret);
        KeyStore keyStore = KeyStore.getInstance("jks");
        keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
        Merlin crypto = new Merlin();
        crypto.setKeyStore(keyStore);
        CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
        cryptoType.setAlias("transmitter");
        samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
        outSecurityProperties.setCallbackHandler(callbackHandler);
        outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
        outSecurityProperties.setTokenUser("tester");
        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
        outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
View Full Code Here

Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

        actions.add(WSSConstants.TIMESTAMP);
        actions.add(WSSConstants.USERNAMETOKEN);
        actions.add(WSSConstants.SAML_TOKEN_SIGNED);
        actions.add(WSSConstants.ENCRYPT_WITH_DERIVED_KEY);
        outSecurityProperties.setActions(actions);
        SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
        samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
        samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
        samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
        samlCallbackHandler.setIssuer("www.example.com");
        byte[] secret = WSSConstants.generateBytes(128 / 8);
        CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
        callbackHandler.setSecret(secret);
        KeyStore keyStore = KeyStore.getInstance("jks");
        keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
        Merlin crypto = new Merlin();
        crypto.setKeyStore(keyStore);
        CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
        cryptoType.setAlias("transmitter");
        samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
        outSecurityProperties.setCallbackHandler(callbackHandler);
        outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
        outSecurityProperties.setTokenUser("tester");
        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
        outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
View Full Code Here

Examples of org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl

        actions.add(WSSConstants.TIMESTAMP);
        actions.add(WSSConstants.USERNAMETOKEN);
        actions.add(WSSConstants.SAML_TOKEN_SIGNED);
        actions.add(WSSConstants.ENCRYPT_WITH_DERIVED_KEY);
        outSecurityProperties.setActions(actions);
        SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
        samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
        samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
        samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
        samlCallbackHandler.setIssuer("www.example.com");
        byte[] secret = WSSConstants.generateBytes(128 / 8);
        CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
        callbackHandler.setSecret(secret);
        KeyStore keyStore = KeyStore.getInstance("jks");
        keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
        Merlin crypto = new Merlin();
        crypto.setKeyStore(keyStore);
        CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
        cryptoType.setAlias("transmitter");
        samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
        outSecurityProperties.setCallbackHandler(callbackHandler);
        outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
        outSecurityProperties.setTokenUser("tester");
        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
        outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
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.