/** * Create an AuthnStatement * @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)); authnStatement.setAuthnContext(act); return authnStatement; }
private void populateSessionIndex(HttpServletRequest httpRequest, LogoutRequestType lot) throws ProcessingException, ConfigurationException, ParsingException { Document currentAssertion = (Document) httpRequest.getSession().getAttribute(GeneralConstants.ASSERTION_SESSION_ATTRIBUTE_NAME); if (currentAssertion != null) { AssertionType assertionType = SAMLUtil.fromElement(currentAssertion.getDocumentElement()); 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); } break; } } } }
AuthnStatementType authnStatementType = new AuthnStatementType(issueInstant); authnStatementType.setSessionIndex(StaxParserUtil.getAttributeValue(sessionIndex)); authnStatementType.setSubjectLocality(subjectLocalityType); StaxParserUtil.validate(StaxParserUtil.getNextEndElement(xmlEventReader), JBossSAMLConstants.SUBJECT_LOCALITY.get()); authnStatementType.setAuthnContext(parseAuthnContextType(xmlEventReader));
/** * Write an {@code AuthnStatementType} to stream * * @param authnStatement * @param out * @throws ProcessingException */ public void write(AuthnStatementType authnStatement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_STATEMENT.get(), ASSERTION_NSURI.get()); XMLGregorianCalendar authnInstant = authnStatement.getAuthnInstant(); if (authnInstant != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.AUTHN_INSTANT.get(), authnInstant.toString()); } String sessionIndex = authnStatement.getSessionIndex(); if (sessionIndex != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SESSION_INDEX.get(), sessionIndex); } AuthnContextType authnContext = authnStatement.getAuthnContext(); if (authnContext != null) write(authnContext); StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Write an {@code AuthnStatementType} to stream * * @param authnStatement * @param out * @throws ProcessingException */ public void write(AuthnStatementType authnStatement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_STATEMENT.get(), ASSERTION_NSURI.get()); XMLGregorianCalendar authnInstant = authnStatement.getAuthnInstant(); if (authnInstant != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.AUTHN_INSTANT.get(), authnInstant.toString()); } AuthnContextType authnContext = authnStatement.getAuthnContext(); if (authnContext != null) write(authnContext); StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
authContextRef); authnStatement.setSessionIndex(assertion.getID());
AuthnStatementType authnStatementType = new AuthnStatementType(issueInstant); authnStatementType.setSessionIndex(StaxParserUtil.getAttributeValue(sessionIndex)); authnStatementType.setSubjectLocality(subjectLocalityType); StaxParserUtil.validate(StaxParserUtil.getNextEndElement(xmlEventReader), JBossSAMLConstants.SUBJECT_LOCALITY.get()); authnStatementType.setAuthnContext(parseAuthnContextType(xmlEventReader));
/** * Write an {@code AuthnStatementType} to stream * * @param authnStatement * @param out * * @throws ProcessingException */ public void write(AuthnStatementType authnStatement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_STATEMENT.get(), ASSERTION_NSURI.get()); XMLGregorianCalendar authnInstant = authnStatement.getAuthnInstant(); if (authnInstant != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.AUTHN_INSTANT.get(), authnInstant.toString()); } String sessionIndex = authnStatement.getSessionIndex(); if (sessionIndex != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SESSION_INDEX.get(), sessionIndex); } AuthnContextType authnContext = authnStatement.getAuthnContext(); if (authnContext != null) write(authnContext); StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Write an {@code AuthnStatementType} to stream * * @param authnStatement * @param out * @throws ProcessingException */ public void write(AuthnStatementType authnStatement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_STATEMENT.get(), ASSERTION_NSURI.get()); XMLGregorianCalendar authnInstant = authnStatement.getAuthnInstant(); if (authnInstant != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.AUTHN_INSTANT.get(), authnInstant.toString()); } AuthnContextType authnContext = authnStatement.getAuthnContext(); if (authnContext != null) write(authnContext); StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
authContextRef); authnStatement.setSessionIndex(assertion.getID());
AuthnStatementType authnStatementType = new AuthnStatementType(issueInstant); authnStatementType.setSessionIndex(StaxParserUtil.getAttributeValue(sessionIndex)); 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());
/** * Create an AuthnStatementType given the issue instant and the type of authentication * * @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; }
/** * Write an {@code AuthnStatementType} to stream * * @param authnStatement * @param out * * @throws ProcessingException */ public void write(AuthnStatementType authnStatement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_STATEMENT.get(), ASSERTION_NSURI.get()); XMLGregorianCalendar authnInstant = authnStatement.getAuthnInstant(); if (authnInstant != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.AUTHN_INSTANT.get(), authnInstant.toString()); } String sessionIndex = authnStatement.getSessionIndex(); if (sessionIndex != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SESSION_INDEX.get(), sessionIndex); } AuthnContextType authnContext = authnStatement.getAuthnContext(); if (authnContext != null) write(authnContext); StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
authContextRef); authnStatement.setSessionIndex(assertion.getID());
private void populateSessionIndex(HttpServletRequest httpRequest, LogoutRequestType lot) throws ProcessingException, ConfigurationException, ParsingException { Document currentAssertion = (Document) httpRequest.getSession().getAttribute(GeneralConstants.ASSERTION_SESSION_ATTRIBUTE_NAME); if (currentAssertion != null) { AssertionType assertionType = SAMLUtil.fromElement(currentAssertion.getDocumentElement()); 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); } break; } } } }
AuthnStatementType authnStatementType = new AuthnStatementType(issueInstant); authnStatementType.setSessionIndex(StaxParserUtil.getAttributeValue(sessionIndex)); 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());
/** * Create an AuthnStatementType given the issue instant and the type of authentication * * @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; }
private void populateSessionIndex(HttpServletRequest httpRequest, LogoutRequestType lot) throws ProcessingException, ConfigurationException, ParsingException { Document currentAssertion = (Document) httpRequest.getSession().getAttribute(GeneralConstants.ASSERTION_SESSION_ATTRIBUTE_NAME); if (currentAssertion != null) { AssertionType assertionType = SAMLUtil.fromElement(currentAssertion.getDocumentElement()); 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); } break; } } } }
AuthnStatementType authnStatementType = new AuthnStatementType(issueInstant); authnStatementType.setSessionIndex(StaxParserUtil.getAttributeValue(sessionIndex)); 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());
/** * Create an AuthnStatementType given the issue instant and the type of authentication * * @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; }