Examples of AuthnStatementType


Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

        Attribute authnInstant = startElement.getAttributeByName(new QName("AuthnInstant"));
        if (authnInstant == null)
            throw logger.parserRequiredAttribute("AuthnInstant");

        XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(authnInstant));
        AuthnStatementType authnStatementType = new AuthnStatementType(issueInstant);

        Attribute sessionIndex = startElement.getAttributeByName(new QName("SessionIndex"));
        if (sessionIndex != null)
            authnStatementType.setSessionIndex(StaxParserUtil.getAttributeValue(sessionIndex));

        while (xmlEventReader.hasNext()) {
            XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
            if (xmlEvent == null)
                break;

            if (xmlEvent instanceof EndElement) {
                xmlEvent = StaxParserUtil.getNextEvent(xmlEventReader);
                EndElement endElement = (EndElement) xmlEvent;
                String endElementTag = StaxParserUtil.getEndElementName(endElement);
                if (endElementTag.equals(AUTHNSTATEMENT))
                    break;
                else
                    throw logger.parserUnknownEndElement(endElementTag);
            }
            startElement = null;

            if (xmlEvent instanceof StartElement) {
                startElement = (StartElement) xmlEvent;
            } else {
                startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);
            }
            if (startElement == null)
                break;

            String tag = StaxParserUtil.getStartElementName(startElement);

            if (JBossSAMLConstants.SUBJECT_LOCALITY.get().equals(tag)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                SubjectLocalityType subjectLocalityType = new SubjectLocalityType();
                Attribute address = startElement.getAttributeByName(new QName(JBossSAMLConstants.ADDRESS.get()));
                if (address != null) {
                    subjectLocalityType.setAddress(StaxParserUtil.getAttributeValue(address));
                }
                Attribute dns = startElement.getAttributeByName(new QName(JBossSAMLConstants.DNS_NAME.get()));
                if (dns != null) {
                    subjectLocalityType.setDNSName(StaxParserUtil.getAttributeValue(dns));
                }
                authnStatementType.setSubjectLocality(subjectLocalityType);
                StaxParserUtil.validate(StaxParserUtil.getNextEndElement(xmlEventReader),
                        JBossSAMLConstants.SUBJECT_LOCALITY.get());
            } else if (JBossSAMLConstants.AUTHN_CONTEXT.get().equals(tag)) {
                authnStatementType.setAuthnContext(parseAuthnContextType(xmlEventReader));
            } else
                throw logger.parserUnknownTag(tag, startElement.getLocation());

        }
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

        SAML2Response response = new SAML2Response();

        String authnContextDeclRef = JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT.get();

        AuthnStatementType authnStatement = response.createAuthnStatement(authnContextDeclRef, XMLTimeUtil.getIssueInstant());

        // Create an assertion
        AssertionType assertion = response.createAssertion(id, issuerInfo.getIssuer());
        assertion.addStatement(authnStatement);
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

        Set<StatementAbstractType> statements = assertion.getStatements();
        assertEquals(2, statements.size());

        Iterator<StatementAbstractType> iter = statements.iterator();
        AuthnStatementType authnStatement = (AuthnStatementType) iter.next();
        assertEquals(XMLTimeUtil.parse("2004-12-05T09:22:00Z"), authnStatement.getAuthnInstant());
        assertEquals("b07b804c-7c29-ea16-7300-4f3d6f7928ac", authnStatement.getSessionIndex());

        AttributeStatementType attributeStatement = (AttributeStatementType) iter.next();
        List<ASTChoiceType> attributes = attributeStatement.getAttributes();
        assertEquals(1, attributes.size());
        AttributeType attribute = attributes.get(0).getAttribute();
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

        assertEquals("2.0", assertion1.getVersion());
        assertEquals("testIssuer", assertion1.getIssuer().getValue());

        Iterator<StatementAbstractType> iterator = assertion1.getStatements().iterator();

        AuthnStatementType authnStatement = (AuthnStatementType) iterator.next();
        assertEquals(XMLTimeUtil.parse("2009-05-26T14:06:26.359-05:00"), authnStatement.getAuthnInstant());

        AuthnContextType authnContext = authnStatement.getAuthnContext();

        AuthnContextDeclRefType refType = (AuthnContextDeclRefType) authnContext.getURIType().iterator().next();
        assertEquals("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", refType.getValue().toASCIIString());
        /*
         * JAXBElement<?> authnContextDeclRefJaxb = (JAXBElement<?>) authnStatement.getAuthnContext().getContent().get(0);
         * assertEquals( "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", authnContextDeclRefJaxb.getValue()
         * );
         */

        AssertionType assertion2 = assertionList.get(1).getAssertion();
        assertEquals("ID_976d8310-658a-450d-be39-f33c73c8afa6", assertion2.getID());
        assertEquals(XMLTimeUtil.parse("2009-05-26T14:06:26.363-05:00"), assertion2.getIssueInstant());
        assertEquals("2.0", assertion2.getVersion());
        assertEquals("testIssuer", assertion2.getIssuer().getValue());

        authnStatement = (AuthnStatementType) assertion2.getStatements().iterator().next();
        assertEquals(XMLTimeUtil.parse("2009-05-26T14:06:26.359-05:00"), authnStatement.getAuthnInstant());
        SubjectLocalityType subjectLocality = authnStatement.getSubjectLocality();
        assertNotNull(subjectLocality);
        assertEquals("127.0.0.1", subjectLocality.getAddress());
        authnContext = authnStatement.getAuthnContext();

        refType = (AuthnContextDeclRefType) authnContext.getURIType().iterator().next();
        assertEquals("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", refType.getValue().toASCIIString());

        // Let us do some writing - currently only visual inspection. We will do proper validation later.
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

        RTChoiceType rtc = choices.get(0);
        AssertionType assertion = rtc.getAssertion();
        Set<StatementAbstractType> statements = assertion.getStatements();
        for (StatementAbstractType statement : statements) {
            if (statement instanceof AuthnStatementType) {
                AuthnStatementType authnStat = (AuthnStatementType) statement;
                AuthnContextType authnContext = authnStat.getAuthnContext();

                AuthnContextTypeSequence sequence = authnContext.getSequence();
                assertNotNull(sequence);
                assertEquals("urn:federation:authentication:windows", sequence.getClassRef().getValue().toString());
            } else if (statement instanceof AttributeStatementType) {
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

        SAML2Response response = new SAML2Response();

        String authnContextDeclRef = JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT.get();

        AuthnStatementType authnStatement = response.createAuthnStatement(authnContextDeclRef, XMLTimeUtil.getIssueInstant());

        // Create an assertion
        AssertionType assertion = response.createAssertion(id, issuerInfo.getIssuer());

        SubjectType subject = new SubjectType();
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

     * @param instant an instanceof {@link XMLGregorianCalendar}
     * @param authnContextClassRefValue indicate the type of authentication performed
     * @return {@link AuthnStatementType}
     */
    public static AuthnStatementType createAuthnStatement(XMLGregorianCalendar instant, String authnContextClassRefValue) {
        AuthnStatementType authnStatement = new AuthnStatementType(instant);

        AuthnContextType authnContext = new AuthnContextType();
        AuthnContextClassRefType authnContextClassRef = new AuthnContextClassRefType(URI.create(authnContextClassRefValue));

        AuthnContextTypeSequence sequence = (authnContext).new AuthnContextTypeSequence();
        sequence.setClassRef(authnContextClassRef);
        authnContext.setSequence(sequence);

        authnStatement.setAuthnContext(authnContext);

        return authnStatement;
    }
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

               
                Set<StatementAbstractType> statements = assertionType.getStatements();
               
                for (StatementAbstractType statementAbstractType : statements) {
                    if (AuthnStatementType.class.isInstance(statementAbstractType)) {
                        AuthnStatementType authnStatement = (AuthnStatementType) statementAbstractType;
                       
                        String sessionIndex = authnStatement.getSessionIndex();
                       
                        if (sessionIndex != null) {
                            lot.addSessionIndex(sessionIndex);
                        }
                       
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

            if (handlerConfig.getParameter(DISABLE_AUTHN_STATEMENT) == null) {
                String authContextRef = JBossSAMLURIConstants.AC_PASSWORD.get();
                if (StringUtil.isNotNull(authMethod))
                    authContextRef = authMethod;

                AuthnStatementType authnStatement = StatementUtil.createAuthnStatement(XMLTimeUtil.getIssueInstant(),
                        authContextRef);

                authnStatement.setSessionIndex(assertion.getID());

                assertion.addStatement(authnStatement);
            }

            if (handlerConfig.getParameter(DISABLE_SENDING_ROLES) == null && (roles != null && !roles.isEmpty())) {
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v2.assertion.AuthnStatementType

     * @param authnContextDeclRef such as JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT
     * @param issueInstant
     * @return
     */
    public AuthnStatementType createAuthnStatement(String authnContextDeclRef, XMLGregorianCalendar issueInstant) {
        AuthnStatementType authnStatement = new AuthnStatementType(issueInstant);
        AuthnContextType act = new AuthnContextType();
        String authContextDeclRef = JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT.get();
        act.addAuthenticatingAuthority(URI.create(authContextDeclRef));

        AuthnContextTypeSequence sequence = act.new AuthnContextTypeSequence();
        sequence.setClassRef(new AuthnContextClassRefType(URI.create(JBossSAMLURIConstants.AC_PASSWORD.get())));
        act.setSequence(sequence);

        authnStatement.setAuthnContext(act);
        return authnStatement;
    }
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.