Package org.picketlink.identity.federation.core.wstrust

Examples of org.picketlink.identity.federation.core.wstrust.SamlCredential


        XMLAssert.assertXMLEqual(expectedAssertion, actual);
    }

    public void testShouldThrowIfStringIsNull() {
        try {
            new SamlCredential((String) null);
            fail("Should not be allowed to create a SamlCredential with a null token string");
        } catch (final Exception e) {
            assertTrue(e instanceof IllegalArgumentException);
        }
    }
View Full Code Here


            assertTrue(e instanceof IllegalArgumentException);
        }
    }

    public void testEqualsContract() throws Exception {
        final SamlCredential samlPrincipal1 = new SamlCredential(assertionElement);
        final SamlCredential samlPrincipal2 = new SamlCredential(assertionElement);
        assertEquals(samlPrincipal1, samlPrincipal2);
        assertEquals(samlPrincipal1.hashCode(), samlPrincipal2.hashCode());
    }
View Full Code Here

        Set<Object> creds = subject.getPublicCredentials();
        if (creds != null) {
            for (Object cred : creds) {
                if (cred instanceof SamlCredential) {
                    SamlCredential samlCredential = (SamlCredential) cred;
                    try {
                        assertion = samlCredential.getAssertionAsElement();
                    } catch (ProcessingException e) {
                        logger.samlAssertionPasingFailed(e);
                    }
                    break;
                }
View Full Code Here

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos));
                writer.write(assertion);
                SamlCredential cred = new SamlCredential(new String(baos.toByteArray()));
                theSubject.getPublicCredentials().add(cred);
            } catch (ProcessingException e) {
                throw new RuntimeException(e);
            }
            return true;
View Full Code Here

                if (AssertionUtil.hasExpired(assertionType))
                    throw new RuntimeException(logger.samlAssertionExpiredError());
            } catch (Exception e) {
                logger.samlAssertionPasingFailed(e);
            }
            SamlCredential credential = new SamlCredential(assertion);
            if (logger.isTraceEnabled()) {
                logger.trace("Assertion included in SOAP payload: " + credential.getAssertionAsString());
            }
            Element subject = Util.findElement(assertion, new QName(assertionNS, "Subject"));
            Element nameID = Util.findElement(subject, new QName(assertionNS, "NameID"));
            String username = getUsername(nameID);
           
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.wstrust.SamlCredential

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.