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; } } } }
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; } } } }
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; } } } }
principal.setSessionIndex(authnStatement.getSessionIndex()); principal.setNameId(nameId);
/** * 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()); } 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()); } 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); }