Examples of SAML11AuthenticationStatementType


Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

            throw logger.processingError(e);
        }

        // Create authentication statement
        URI authenticationMethod = URI.create(samlProtocolContext.getAuthMethod());
        SAML11AuthenticationStatementType stat = new SAML11AuthenticationStatementType(authenticationMethod, issueInstant);
        stat.setSubject(subject);
        assertionType.add(stat);

        try {
            this.tokenRegistry.addToken(assertionID, assertionType);
        } catch (IOException e) {
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

                SAML11ConditionsType conditions = SAML11ParserUtil.parseSAML11Conditions(xmlEventReader);
                assertion.setConditions(conditions);
            } else if (SAML11Constants.AUTHENTICATION_STATEMENT.equals(tag)) {
                startElement = (StartElement) xmlEvent;
                SAML11AuthenticationStatementType authStat = SAML11ParserUtil.parseAuthenticationStatement(xmlEventReader);
                assertion.add(authStat);
            } else if (SAML11Constants.ATTRIBUTE_STATEMENT.equalsIgnoreCase(tag)) {
                SAML11AttributeStatementType attributeStatementType = SAML11ParserUtil
                        .parseSAML11AttributeStatement(xmlEventReader);
                assertion.add(attributeStatementType);
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

        SAML11SubjectType subject = new SAML11SubjectType();
        subject.setChoice(new SAML11SubjectType.SAML11SubjectTypeChoice(nameId));
        subject.setSubjectConfirmation(subjectConfirmation);

        // add the subject to an auth statement.
        SAML11AuthenticationStatementType authStatement = new SAML11AuthenticationStatementType(
                URI.create("urn:picketlink:auth"), lifetime.getCreated());
        authStatement.setSubject(subject);

        // TODO: add attribute statements.

        // create the SAML assertion.
        SAML11AssertionType assertion = new SAML11AssertionType(assertionID, lifetime.getCreated());
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

        Attribute authInstant = startElement.getAttributeByName(new QName(SAML11Constants.AUTHENTICATION_INSTANT));
        if (authInstant == null)
            throw logger.parserRequiredAttribute(SAML11Constants.AUTHENTICATION_INSTANT);

        SAML11AuthenticationStatementType authStat = new SAML11AuthenticationStatementType(URI.create(StaxParserUtil
                .getAttributeValue(authMethod)), XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(authInstant)));

        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(SAML11Constants.AUTHENTICATION_STATEMENT))
                    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.get().equalsIgnoreCase(tag)) {
                SAML11SubjectParser subjectParser = new SAML11SubjectParser();
                SAML11SubjectType subject = (SAML11SubjectType) subjectParser.parse(xmlEventReader);
                SAML11SubjectStatementType subStat = new SAML11SubjectStatementType();
                subStat.setSubject(subject);

                authStat.setSubject(subject);
            } else if (JBossSAMLConstants.SUBJECT_LOCALITY.get().equals(tag)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                SAML11SubjectLocalityType subjectLocalityType = new SAML11SubjectLocalityType();
                Attribute address = startElement.getAttributeByName(new QName(SAML11Constants.IP_ADDRESS));
                if (address != null) {
                    subjectLocalityType.setIpAddress(StaxParserUtil.getAttributeValue(address));
                }
                Attribute dns = startElement.getAttributeByName(new QName(SAML11Constants.DNS_ADDRESS));
                if (dns != null) {
                    subjectLocalityType.setDnsAddress(StaxParserUtil.getAttributeValue(dns));
                }
                authStat.setSubjectLocality(subjectLocalityType);
                StaxParserUtil.validate(StaxParserUtil.getNextEndElement(xmlEventReader),
                        JBossSAMLConstants.SUBJECT_LOCALITY.get());
            } else if (SAML11Constants.AUTHORITY_BINDING.equals(tag)) {
                Attribute authorityKindAttr = startElement.getAttributeByName(new QName(SAML11Constants.AUTHORITY_KIND));
                if (authorityKindAttr == null)
                    throw logger.parserRequiredAttribute("AuthorityKind");

                Attribute locationAttr = startElement.getAttributeByName(new QName(SAML11Constants.LOCATION));
                if (locationAttr == null)
                    throw logger.parserRequiredAttribute("Location");
                URI location = URI.create(StaxParserUtil.getAttributeValue(locationAttr));

                Attribute bindingAttr = startElement.getAttributeByName(new QName(SAML11Constants.BINDING));
                if (bindingAttr == null)
                    throw logger.parserRequiredAttribute("Binding");
                URI binding = URI.create(StaxParserUtil.getAttributeValue(bindingAttr));

                QName authorityKind = QName.valueOf(StaxParserUtil.getAttributeValue(authorityKindAttr));

                SAML11AuthorityBindingType authorityBinding = new SAML11AuthorityBindingType(authorityKind, location, binding);
                authStat.add(authorityBinding);
            } else
                throw logger.parserUnknownTag("", startElement.getLocation());

        }
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

        assertEquals("Unexpected assertion issuer name", "Test STS", assertion.getIssuer());

        // validate the assertion authentication statement.
        List<SAML11StatementAbstractType> statements = assertion.getStatements();
        assertTrue("At least one statement is expected in a SAMLV1.1 assertion", statements.size() > 0);
        SAML11AuthenticationStatementType authStatement = null;
        for (SAML11StatementAbstractType statement : statements) {
            if (statement instanceof SAML11AuthenticationStatementType) {
                authStatement = (SAML11AuthenticationStatementType) statement;
                break;
            }
        }
        assertNotNull("SAMLV1.1 assertion is missing the authentication statement", authStatement);

        // validate the assertion subject.
        assertNotNull("Unexpected null subject", authStatement.getSubject());
        SAML11SubjectType subject = authStatement.getSubject();

        SAML11NameIdentifierType nameID = subject.getChoice().getNameID();
        assertEquals("Unexpected NameIdentifier format", SAML11Constants.FORMAT_UNSPECIFIED, nameID.getFormat().toString());
        assertEquals("Unexpected NameIdentifier value", principal, nameID.getValue());
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

        SAML11ConditionsType conditions = assertion.getConditions();
        assertEquals(XMLTimeUtil.parse("2002-06-19T17:00:37.795Z"), conditions.getNotBefore());
        assertEquals(XMLTimeUtil.parse("2002-06-19T17:10:37.795Z"), conditions.getNotOnOrAfter());

        SAML11AuthenticationStatementType stat = (SAML11AuthenticationStatementType) assertion.getStatements().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:am:password", stat.getAuthenticationMethod().toString());
        assertEquals(XMLTimeUtil.parse("2002-06-19T17:05:17.706Z"), stat.getAuthenticationInstant());

        SAML11SubjectType subject = stat.getSubject();
        SAML11SubjectType.SAML11SubjectTypeChoice choice = subject.getChoice();
        assertEquals("user@idp.example.org", choice.getNameID().getValue());
        assertEquals("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", choice.getNameID().getFormat().toString());

        SAML11SubjectConfirmationType subjectConfirm = subject.getSubjectConfirmation();
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

        SAML11ConditionsType conditions = assertion.getConditions();
        assertEquals(XMLTimeUtil.parse("2002-06-19T17:05:37.795Z"), conditions.getNotBefore());
        assertEquals(XMLTimeUtil.parse("2002-06-19T17:15:37.795Z"), conditions.getNotOnOrAfter());

        SAML11AuthenticationStatementType stat = (SAML11AuthenticationStatementType) assertion.getStatements().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:am:password", stat.getAuthenticationMethod().toString());
        assertEquals(XMLTimeUtil.parse("2002-06-19T17:08:37.795Z"), stat.getAuthenticationInstant());

        SAML11SubjectType subject = stat.getSubject();
        SAML11SubjectType.SAML11SubjectTypeChoice choice = subject.getChoice();
        assertEquals("user@idp.example.org", choice.getNameID().getValue());
        assertEquals("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", choice.getNameID().getFormat().toString());

        SAML11SubjectConfirmationType subjectConfirm = subject.getSubjectConfirmation();
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

        attr = attributes.get(3);
        assertEquals("accountState", attr.getAttributeName());
        assertEquals("http://jboss.org/test", attr.getAttributeNamespace().toString());
        assertEquals("ACTIVE", attr.get().get(0));

        SAML11AuthenticationStatementType authStat = (SAML11AuthenticationStatementType) statements.get(1);
        assertEquals(XMLTimeUtil.parse("2008-12-10T14:12:14.741Z"), authStat.getAuthenticationInstant());
        assertEquals("urn:oasis:names:tc:SAML:1.0:am:password", authStat.getAuthenticationMethod().toString());
        subject = authStat.getSubject();
        choice = subject.getChoice();
        nameID = choice.getNameID();
        assertEquals("johnq", nameID.getValue());
        subjConf = subject.getSubjectConfirmation();
        confirmationMethod = subjConf.getConfirmationMethod().get(0);
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

        assertEquals("http://jboss.org/test", assertion.getIssuer());
        assertEquals(XMLTimeUtil.parse("2006-05-24T05:52:32Z"), assertion.getIssueInstant());

        List<SAML11StatementAbstractType> statements = assertion.getStatements();
        assertEquals(1, statements.size());
        SAML11AuthenticationStatementType authStat = (SAML11AuthenticationStatementType) statements.get(0);
        assertEquals(XMLTimeUtil.parse("2006-05-24T05:52:30Z"), authStat.getAuthenticationInstant());
        assertEquals("urn:picketlink:auth", authStat.getAuthenticationMethod().toString());
        SAML11SubjectType subject = authStat.getSubject();
        SAML11SubjectTypeChoice choice = subject.getChoice();
        SAML11NameIdentifierType nameID = choice.getNameID();
        assertEquals("anil", nameID.getValue());
        SAML11SubjectConfirmationType subjConf = subject.getSubjectConfirmation();
        URI confirmationMethod = subjConf.getConfirmationMethod().get(0);
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11AuthenticationStatementType

                if (assertion != null) {
                    // Get the subject
                    List<SAML11StatementAbstractType> statements = assertion.getStatements();
                    for (SAML11StatementAbstractType statement : statements) {
                        if (statement instanceof SAML11AuthenticationStatementType) {
                            SAML11AuthenticationStatementType subStat = (SAML11AuthenticationStatementType) statement;
                            SAML11SubjectType subject = subStat.getSubject();
                            username = subject.getChoice().getNameID().getValue();
                        }
                    }
                    roles = AssertionUtil.getRoles(assertion, null);
                }
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.