use of org.forgerock.openam.sso.providers.stateless.StatelessSession in project OpenAM by OpenRock.
the class StatelessOperations method logout.
@Override
public void logout(final Session session) throws SessionException {
if (session instanceof StatelessSession) {
SessionInfo sessionInfo = statelessSessionFactory.getSessionInfo(session.getID());
sessionLogging.logEvent(sessionInfo, SessionEvent.LOGOUT);
// Required since not possible to mock SessionAuditor in test case
if (sessionAuditor != null) {
sessionAuditor.auditActivity(sessionInfo, AM_SESSION_LOGGED_OUT);
}
}
sessionBlacklist.blacklist(session);
}
use of org.forgerock.openam.sso.providers.stateless.StatelessSession in project OpenAM by OpenRock.
the class StatelessOperations method destroy.
@Override
public void destroy(final Session requester, final Session session) throws SessionException {
sessionService.checkPermissionToDestroySession(requester, session.getID());
if (session instanceof StatelessSession) {
SessionInfo sessionInfo = statelessSessionFactory.getSessionInfo(session.getID());
sessionLogging.logEvent(sessionInfo, SessionEvent.DESTROY);
// Required since not possible to mock SessionAuditor in test case
if (sessionAuditor != null) {
sessionAuditor.auditActivity(sessionInfo, AM_SESSION_DESTROYED);
}
}
sessionBlacklist.blacklist(session);
}
use of org.forgerock.openam.sso.providers.stateless.StatelessSession in project OpenAM by OpenRock.
the class StatelessSessionActivatorTest method shouldGenerateStatelessSessionId.
@Test
public void shouldGenerateStatelessSessionId() throws Exception {
// Given
InternalSession mockSession = mock(InternalSession.class);
String userDn = "fred";
given(mockLoginState.getUserDN()).willReturn(userDn);
given(mockSession.activate(userDn, true)).willReturn(true);
StatelessSession mockStatelessSession = mock(StatelessSession.class);
given(mockSessionFactory.generate(mockSession)).willReturn(mockStatelessSession);
SessionID statelessSessionId = new SessionID("stateless");
given(mockStatelessSession.getID()).willReturn(statelessSessionId);
// When
testActivator.activateSession(mockSession, mockLoginState);
// Then
verify(mockSessionFactory).generate(mockSession);
verify(mockLoginState).setSessionID(statelessSessionId);
}
Aggregations