Search in sources :

Example 36 with SessionInfo

use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.

the class InternalSession method removeSession.

/**
     * Signals the Session for removal.
     */
private void removeSession() {
    SessionInfo sessionInfo = toSessionInfo();
    sessionLogging.logEvent(sessionInfo, SessionEvent.DESTROY);
    sessionAuditor.auditActivity(sessionInfo, AM_SESSION_DESTROYED);
    setState(DESTROYED);
    sessionService.removeInternalSession(sessionID);
    sessionService.sendEvent(this, SessionEvent.DESTROY);
}
Also used : SessionInfo(com.iplanet.dpro.session.share.SessionInfo)

Example 37 with SessionInfo

use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.

the class CTSOperationsTest method shouldReadTokenFromCTS.

@Test
public void shouldReadTokenFromCTS() throws CoreTokenException, SessionException {
    // Given
    Token mockToken = mock(Token.class);
    given(mockCTS.read(anyString())).willReturn(mockToken);
    InternalSession mockInternalSession = mock(InternalSession.class);
    given(mockAdapter.fromToken(eq(mockToken))).willReturn(mockInternalSession);
    SessionInfo mockSessionInfo = mock(SessionInfo.class);
    given(mockInfoFactory.getSessionInfo(eq(mockInternalSession), any(SessionID.class))).willReturn(mockSessionInfo);
    // When
    SessionInfo result = ctsOperations.refresh(mockSession, false);
    // Then
    assertThat(result).isEqualTo(mockSessionInfo);
}
Also used : InternalSession(com.iplanet.dpro.session.service.InternalSession) SessionInfo(com.iplanet.dpro.session.share.SessionInfo) Token(org.forgerock.openam.cts.api.tokens.Token) SessionID(com.iplanet.dpro.session.SessionID) Test(org.testng.annotations.Test)

Example 38 with SessionInfo

use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.

the class StatelessOperationsTest method shouldRefreshFromStatelessSessionFactory.

@Test
public void shouldRefreshFromStatelessSessionFactory() throws Exception {
    // Given
    SessionInfo info = new SessionInfo();
    info.setExpiryTime(System.currentTimeMillis() + (1000 * 60 * 10));
    given(mockSessionFactory.getSessionInfo(sid)).willReturn(info);
    // When
    SessionInfo result = statelessOperations.refresh(mockSession, false);
    // Then
    verify(mockSessionFactory).getSessionInfo(sid);
    assertThat(result).isSameAs(info);
}
Also used : SessionInfo(com.iplanet.dpro.session.share.SessionInfo) Test(org.testng.annotations.Test)

Example 39 with SessionInfo

use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.

the class StatelessOperationsTest method refreshShouldTimeoutFromStatelessSessionFactory.

@Test(expectedExceptions = SessionTimedOutException.class)
public void refreshShouldTimeoutFromStatelessSessionFactory() throws Exception {
    // Given
    SessionInfo info = new SessionInfo();
    given(mockSessionFactory.getSessionInfo(sid)).willReturn(info);
    // When
    SessionInfo result = statelessOperations.refresh(mockSession, false);
// Then exception should be thrown, as session is timed-out
}
Also used : SessionInfo(com.iplanet.dpro.session.share.SessionInfo) Test(org.testng.annotations.Test)

Example 40 with SessionInfo

use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.

the class StatelessJWTCacheTest method shouldClearCache.

@Test
public void shouldClearCache() {
    // Given
    given(mockConfig.getJWTCacheSize()).willReturn(1);
    cache = new StatelessJWTCache(mockConfig, mockListeners);
    SessionInfo mockSessionInfo = mock(SessionInfo.class);
    cache.cache(mockSessionInfo, "badger");
    // When
    cache.clear();
    // Then
    assertThat(cache.contains(mockSessionInfo)).isFalse();
}
Also used : SessionInfo(com.iplanet.dpro.session.share.SessionInfo) Test(org.testng.annotations.Test)

Aggregations

SessionInfo (com.iplanet.dpro.session.share.SessionInfo)42 Test (org.testng.annotations.Test)18 SessionException (com.iplanet.dpro.session.SessionException)8 SessionID (com.iplanet.dpro.session.SessionID)6 SessionResponse (com.iplanet.dpro.session.share.SessionResponse)5 SessionRequest (com.iplanet.dpro.session.share.SessionRequest)4 InternalSession (com.iplanet.dpro.session.service.InternalSession)3 Session (com.iplanet.dpro.session.Session)2 TokenRestriction (com.iplanet.dpro.session.TokenRestriction)2 SSOException (com.iplanet.sso.SSOException)2 URL (java.net.URL)2 KeyPair (java.security.KeyPair)2 HashMap (java.util.HashMap)2 SigningManager (org.forgerock.json.jose.jws.SigningManager)2 StatelessSession (org.forgerock.openam.sso.providers.stateless.StatelessSession)2 ThreadPoolException (com.iplanet.am.util.ThreadPoolException)1 SessionTimedOutException (com.iplanet.dpro.session.SessionTimedOutException)1 SessionOperations (com.iplanet.dpro.session.operations.SessionOperations)1 Action (com.iplanet.services.naming.ServiceListeners.Action)1 SSOToken (com.iplanet.sso.SSOToken)1