Package org.jboss.seam.security.external.saml

Examples of org.jboss.seam.security.external.saml.SamlRedirectMessage


        keyPair = new KeyPair(publicKey, privateKey);
    }

    @Test
    public void testValidSignature() throws ParserConfigurationException, InvalidRequestException, IOException, GeneralSecurityException {
        SamlRedirectMessage samlRedirectMessage = createSignedRedirectMessage();

        // Verify the signature (must not throw an InvalidRequestException)
        samlSignatureUtilForRedirectBinding.validateSignature(samlRedirectMessage, keyPair.getPublic());
    }
View Full Code Here


        samlSignatureUtilForRedirectBinding.validateSignature(samlRedirectMessage, keyPair.getPublic());
    }

    @Test
    public void testInvalidSignature() throws ParserConfigurationException {
        SamlRedirectMessage samlRedirectMessage = createSignedRedirectMessage();

        // Modify the message contents
        samlRedirectMessage.setRelayState("bar");

        // Verify the signature. Verification must fail.
        boolean exception = false;
        try {
            samlSignatureUtilForRedirectBinding.validateSignature(samlRedirectMessage, keyPair.getPublic());
View Full Code Here

        Assert.assertTrue(exception);
    }

    private SamlRedirectMessage createSignedRedirectMessage() {
        SamlRedirectMessage samlRedirectMessage = new SamlRedirectMessage();
        String base64EncodedMessage = Base64.encodeBytes("this is just a test string".getBytes(), Base64.DONT_BREAK_LINES);
        samlRedirectMessage.setRequestOrResponse(SamlRequestOrResponse.REQUEST);
        samlRedirectMessage.setSamlMessage(base64EncodedMessage);
        samlRedirectMessage.setRelayState("foo");
        samlRedirectMessage.encode();
        try {
            samlSignatureUtilForRedirectBinding.sign(samlRedirectMessage, keyPair.getPrivate());
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (GeneralSecurityException e) {
View Full Code Here

TOP

Related Classes of org.jboss.seam.security.external.saml.SamlRedirectMessage

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.