/** * Searches the sessionIndex in the assertion * * @param subjectAssertion assertion from the response * @return the sessionIndex if found in the assertion */ protected String getSessionIndex(final Assertion subjectAssertion) { List<AuthnStatement> authnStatements = subjectAssertion.getAuthnStatements(); if (authnStatements != null && authnStatements.size() > 0) { AuthnStatement statement = authnStatements.get(0); if (statement != null) { return statement.getSessionIndex(); } } return null; }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException { AuthnStatement authnStatement = (AuthnStatement) samlObject; if (authnStatement.getAuthnInstant() != null) { String authnInstantStr = SAMLConfigurationSupport.getSAMLDateFormatter().print( authnStatement.getAuthnInstant()); domElement.setAttributeNS(null, AuthnStatement.AUTHN_INSTANT_ATTRIB_NAME, authnInstantStr); } if (authnStatement.getSessionIndex() != null) { domElement.setAttributeNS(null, AuthnStatement.SESSION_INDEX_ATTRIB_NAME, authnStatement.getSessionIndex()); } if (authnStatement.getSessionNotOnOrAfter() != null) { String sessionNotOnOrAfterStr = SAMLConfigurationSupport.getSAMLDateFormatter().print( authnStatement.getSessionNotOnOrAfter()); domElement.setAttributeNS(null, AuthnStatement.SESSION_NOT_ON_OR_AFTER_ATTRIB_NAME, sessionNotOnOrAfterStr); } } }
for (final Assertion assertion : ((Response) message).getAssertions()) { for (final AuthnStatement statement : assertion.getAuthnStatements()) { if (statement.getSessionIndex() != null) { indexes.add(statement.getSessionIndex());
if (assertion.getSubject() != null && assertion.getSubject().getNameID() != null) { for (final AuthnStatement statement : assertion.getAuthnStatements()) { if (statement.getSessionIndex() != null) { return new Pair<>(assertion, statement);
result.getSecond().getSessionIndex());
protected List<AuthenticationStatement> getAuthenticationStatements( List<AuthnStatement> authnStatements ) { List<AuthenticationStatement> result = new LinkedList<>(); for (AuthnStatement s : ofNullable(authnStatements).orElse(emptyList())) { AuthnContext authnContext = s.getAuthnContext(); AuthnContextClassRef authnContextClassRef = authnContext.getAuthnContextClassRef(); String ref = null; if (authnContextClassRef.getAuthnContextClassRef() != null) { ref = authnContextClassRef.getAuthnContextClassRef(); } result.add( new AuthenticationStatement() .setSessionIndex(s.getSessionIndex()) .setAuthInstant(s.getAuthnInstant()) .setSessionNotOnOrAfter(s.getSessionNotOnOrAfter()) .setAuthenticationContext( authnContext != null ? new AuthenticationContext() .setClassReference(AuthenticationContextClassReference.fromUrn(ref)) : null ) ); } return result; }
responseTO.setSessionIndex(authnStmt.getSessionIndex());
String sessionId = null; if (authnStatement.isPresent()) { sessionId = authnStatement.get().getSessionIndex();