Search in sources :

Example 96 with SessionID

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

the class ServerSessionOperationStrategyTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    // Required dependencies
    mockSessionService = mock(SessionService.class);
    mockNamingQuery = mock(WebtopNamingQuery.class);
    // Strategies
    mockLocal = mock(LocalOperations.class);
    mockRemote = mock(RemoteOperations.class);
    mockStateless = mock(StatelessOperations.class);
    mockCTS = mock(CTSOperations.class);
    mockStore = mock(SessionMonitoringStore.class);
    strategy = new ServerSessionOperationStrategy(mockSessionService, mockStore, mockLocal, mockCTS, mockRemote, mockStateless, mockNamingQuery, mock(StatelessSessionFactory.class), mock(Debug.class));
    // test instances
    mockSession = mock(Session.class);
    SessionID mockSessionId = mock(SessionID.class);
    given(mockSession.getID()).willReturn(mockSessionId);
    given(mockSessionId.getSessionServerID()).willReturn("TEST");
}
Also used : LocalOperations(com.iplanet.dpro.session.operations.strategies.LocalOperations) RemoteOperations(com.iplanet.dpro.session.operations.strategies.RemoteOperations) CTSOperations(com.iplanet.dpro.session.operations.strategies.CTSOperations) SessionService(com.iplanet.dpro.session.service.SessionService) WebtopNamingQuery(com.iplanet.services.naming.WebtopNamingQuery) SessionMonitoringStore(com.iplanet.dpro.session.monitoring.SessionMonitoringStore) StatelessOperations(com.iplanet.dpro.session.operations.strategies.StatelessOperations) SessionID(com.iplanet.dpro.session.SessionID) Session(com.iplanet.dpro.session.Session) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 97 with SessionID

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

the class InternalSessionCacheTest method shouldRemovePreviousRestrictedSession.

@Test
public void shouldRemovePreviousRestrictedSession() {
    // Given
    SessionID oldRestriction = mock(SessionID.class);
    given(session.getRestrictedTokens()).willReturn(new HashSet<SessionID>(Arrays.asList(oldRestriction)));
    cache.put(session);
    SessionID newRestriction = mock(SessionID.class);
    given(session.getRestrictedTokens()).willReturn(new HashSet<SessionID>(Arrays.asList(newRestriction)));
    // When
    cache.put(session);
    // Then
    assertThat(cache.getByRestrictedID(oldRestriction)).isNull();
    assertThat(cache.getByRestrictedID(newRestriction)).isEqualTo(session);
}
Also used : SessionID(com.iplanet.dpro.session.SessionID) Test(org.testng.annotations.Test)

Example 98 with SessionID

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

the class CTSOperationsTest method shouldDThrowExceptionWhenGivenLocalSession.

@Test(expectedExceptions = SessionException.class)
public void shouldDThrowExceptionWhenGivenLocalSession() throws SessionException {
    // Given
    SessionID mockSessionID = mock(SessionID.class);
    given(mockSession.getID()).willReturn(mockSessionID);
    given(mockSessionService.checkSessionLocal(mockSessionID)).willReturn(true);
    // When
    ctsOperations.logout(mockSession);
}
Also used : SessionID(com.iplanet.dpro.session.SessionID) Test(org.testng.annotations.Test)

Example 99 with SessionID

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

the class CTSOperationsTest method shouldNotDeleteLocalTokenDuringLogout.

@Test(expectedExceptions = SessionException.class)
public void shouldNotDeleteLocalTokenDuringLogout() throws SessionException, CoreTokenException {
    // Given
    SessionID mockSessionID = mock(SessionID.class);
    given(mockSession.getID()).willReturn(mockSessionID);
    given(mockSessionService.checkSessionLocal(mockSessionID)).willReturn(true);
    // When
    ctsOperations.logout(mockSession);
}
Also used : SessionID(com.iplanet.dpro.session.SessionID) Test(org.testng.annotations.Test)

Example 100 with SessionID

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

the class CTSOperationsTest method shouldDeleteRemoteTokenDuringLogout.

@Test
public void shouldDeleteRemoteTokenDuringLogout() throws SessionException, CoreTokenException {
    // Given
    SessionID mockSessionID = mock(SessionID.class);
    given(mockSession.getID()).willReturn(mockSessionID);
    given(mockSessionService.checkSessionLocal(mockSessionID)).willReturn(false);
    // When
    ctsOperations.logout(mockSession);
    // Then
    verify(mockRemote).logout(mockSession);
}
Also used : SessionID(com.iplanet.dpro.session.SessionID) Test(org.testng.annotations.Test)

Aggregations

SessionID (com.iplanet.dpro.session.SessionID)105 Test (org.testng.annotations.Test)44 SessionException (com.iplanet.dpro.session.SessionException)31 SSOToken (com.iplanet.sso.SSOToken)23 InternalSession (com.iplanet.dpro.session.service.InternalSession)18 SSOException (com.iplanet.sso.SSOException)18 AuthContextLocalWrapper (org.forgerock.openam.core.rest.authn.core.wrappers.AuthContextLocalWrapper)17 HttpServletResponse (javax.servlet.http.HttpServletResponse)16 HttpServletRequest (javax.servlet.http.HttpServletRequest)15 Session (com.iplanet.dpro.session.Session)14 URL (java.net.URL)9 Map (java.util.Map)9 AuthLoginException (com.sun.identity.authentication.spi.AuthLoginException)8 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 SMSException (com.sun.identity.sm.SMSException)4 Token (org.forgerock.openam.cts.api.tokens.Token)4 SessionIDExtensions (com.iplanet.dpro.session.SessionIDExtensions)3 TokenRestriction (com.iplanet.dpro.session.TokenRestriction)3 SessionInfo (com.iplanet.dpro.session.share.SessionInfo)3