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);
}
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);
}
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);
}
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
}
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();
}
Aggregations