Search in sources :

Example 1 with StatelessSession

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);
}
Also used : StatelessSession(org.forgerock.openam.sso.providers.stateless.StatelessSession) SessionInfo(com.iplanet.dpro.session.share.SessionInfo)

Example 2 with StatelessSession

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);
}
Also used : StatelessSession(org.forgerock.openam.sso.providers.stateless.StatelessSession) SessionInfo(com.iplanet.dpro.session.share.SessionInfo)

Example 3 with StatelessSession

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);
}
Also used : StatelessSession(org.forgerock.openam.sso.providers.stateless.StatelessSession) InternalSession(com.iplanet.dpro.session.service.InternalSession) SessionID(com.iplanet.dpro.session.SessionID) Test(org.testng.annotations.Test)

Aggregations

StatelessSession (org.forgerock.openam.sso.providers.stateless.StatelessSession)3 SessionInfo (com.iplanet.dpro.session.share.SessionInfo)2 SessionID (com.iplanet.dpro.session.SessionID)1 InternalSession (com.iplanet.dpro.session.service.InternalSession)1 Test (org.testng.annotations.Test)1