Examples of SAMLCredential


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

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

            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

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

        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

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

            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

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

                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

Examples of org.springframework.security.saml.SAMLCredential

        Assertion attributeAssertion = helper.getValidAssertion();
        attributeAssertion.getAttributeStatements().add(helper.getAttributeStatement("assertion2", "value2"));
        validResponse.getAssertions().add(attributeAssertion);
        messageContext.setInboundSAMLMessage(validResponse);
        messageContext.setInboundSAMLMessageAuthenticated(true);
        SAMLCredential samlCredential = profile.processAuthenticationResponse(messageContext);
        assertTrue(samlCredential.getAttributes().size() == 1);
    }
View Full Code Here

Examples of org.springframework.security.saml.SAMLCredential

        attributeAssertion.getAttributeStatements().add(helper.getAttributeStatement("assertion2", "value2"));
        validResponse.getAssertions().add(attributeAssertion);
        messageContext.setInboundSAMLMessage(validResponse);
        messageContext.setInboundSAMLMessageAuthenticated(true);
        profile.setIncludeAllAttributes(true);
        SAMLCredential samlCredential = profile.processAuthenticationResponse(messageContext);
        assertTrue(samlCredential.getAttributes().size() == 2);
    }
View Full Code Here

Examples of org.springframework.security.saml.SAMLCredential

            subjectAssertion.releaseDOM();
            subjectAssertion.releaseChildrenDOM(true);
        }

        // Create the credential
        return new SAMLCredential(nameId, subjectAssertion, context.getPeerEntityMetadata().getEntityID(), context.getRelayState(), attributes, context.getLocalEntityId(), additionalData);

    }
View Full Code Here

Examples of org.springframework.security.saml.SAMLCredential

        // Log NameID or principal when available
        sb.append(";");
        if (a != null) {
            if (a.getCredentials() != null && a.getCredentials() instanceof SAMLCredential) {
                SAMLCredential credential = (SAMLCredential) a.getCredentials();
                if (credential.getNameID() != null) {
                    sb.append(credential.getNameID().getValue());
                } else {
                    sb.append(a.getPrincipal());
                }
            } else {
                sb.append(a.getPrincipal());
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.