Search in sources :

Example 26 with SessionInfo

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

the class SessionInfoFactoryTest method shouldGenerateSessionInfoFromInternalSession.

@Test
public void shouldGenerateSessionInfoFromInternalSession() throws SessionException {
    // Given
    given(mockSession.getID()).willReturn(mockSessionID);
    given(mockSession.getRestrictionForToken(any(SessionID.class))).willReturn(mock(TokenRestriction.class));
    given(mockSession.getState()).willReturn(VALID);
    given(mockSession.getTimeLeftBeforePurge()).willReturn(0l);
    SessionInfo mockSessionInfo = mock(SessionInfo.class);
    given(mockSession.toSessionInfo()).willReturn(mockSessionInfo);
    Hashtable mockHashTable = mock(Hashtable.class);
    given(mockSessionInfo.getProperties()).willReturn(mockHashTable);
    given(mockSession.getRestrictionForToken(any(SessionID.class))).willReturn(new MockTokenRestriction());
    // When
    SessionInfo result = factory.getSessionInfo(mockSession, mockSessionID);
    // Then
    assertThat(result).isNotNull();
}
Also used : TokenRestriction(com.iplanet.dpro.session.TokenRestriction) Hashtable(java.util.Hashtable) SessionInfo(com.iplanet.dpro.session.share.SessionInfo) SessionID(com.iplanet.dpro.session.SessionID) Test(org.testng.annotations.Test)

Example 27 with SessionInfo

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

the class RemoteOperationsTest method shouldUseSessionIDInRefreshRequest.

@Test
public void shouldUseSessionIDInRefreshRequest() throws SessionException {
    // Given
    SessionInfo mockSessionInfo = mock(SessionInfo.class);
    given(mockResponse.getSessionInfo()).willReturn(Arrays.asList(mockSessionInfo));
    // When
    SessionInfo result = remoteOperations.refresh(mockSession, true);
    // Then
    assertThat(result).isEqualTo(mockSessionInfo);
}
Also used : SessionInfo(com.iplanet.dpro.session.share.SessionInfo) Test(org.testng.annotations.Test)

Example 28 with SessionInfo

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

the class SessionNotificationHandler method processNotification.

/**
     * Process the notification.
     *
     * @param snot Session Notification object.
     */
private void processNotification(SessionNotification snot, boolean isLocal) {
    SessionInfo info = snot.getSessionInfo();
    sessionDebug.message("SESSION NOTIFICATION : " + info.toXMLString());
    if (!info.getState().equals("valid")) {
        if (isLocal) {
            sessionCache.removeLocalSID(info);
        } else {
            sessionCache.removeRemoteSID(info);
        }
        return;
    }
    SessionID sid = new SessionID(info.getSessionID());
    Session session = sessionCache.readSession(sid);
    try {
        if (session == null) {
            // a new session is created
            return;
        }
        session.update(info);
    } catch (Exception e) {
        sessionDebug.error("SessionNotificationHandler:processNotification : ", e);
        sessionCache.removeSID(sid);
        return;
    }
    SessionEvent evt = new SessionEvent(session, snot.getNotificationType(), snot.getNotificationTime());
    SessionEvent.invokeListeners(evt);
}
Also used : SessionInfo(com.iplanet.dpro.session.share.SessionInfo)

Example 29 with SessionInfo

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

the class MonitoredOperations method refresh.

/**
     * {@inheritDoc}
     */
@Override
public SessionInfo refresh(Session session, boolean reset) throws SessionException {
    final long start = System.nanoTime();
    final SessionInfo response = sessionOperations.refresh(session, reset);
    sessionMonitoringStore.storeRefreshTime(System.nanoTime() - start, monitorType);
    return response;
}
Also used : SessionInfo(com.iplanet.dpro.session.share.SessionInfo)

Example 30 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)

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