Search in sources :

Example 46 with SessionException

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

the class SSOProviderImpl method logout.

@Override
public void logout(final SSOToken token) throws SSOException {
    try {
        Session session = sessionCache.getSession(new SessionID(token.getTokenID().toString()));
        session.logout();
    } catch (SessionException e) {
        if (debug.messageEnabled()) {
            debug.message("Logout: ", e);
        }
        throw new SSOException(e);
    }
}
Also used : SessionException(com.iplanet.dpro.session.SessionException) SSOException(com.iplanet.sso.SSOException) SessionID(com.iplanet.dpro.session.SessionID) Session(com.iplanet.dpro.session.Session)

Example 47 with SessionException

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

the class AuthD method initAuthSession.

private Session initAuthSession() throws SSOException, SessionException {
    final Session authSession = getSessionService().getAuthenticationSession(defaultOrg, null);
    if (authSession == null) {
        debug.error("AuthD failed to get auth session");
        throw new SessionException(BUNDLE_NAME, "gettingSessionFailed", null);
    }
    String clientID = authSession.getClientID();
    authSession.setProperty("Principal", clientID);
    authSession.setProperty("Organization", defaultOrg);
    authSession.setProperty("Host", authSession.getID().getSessionServer());
    if (LDAPUtils.isDN(clientID)) {
        String id = "id=" + rdnValueFromDn(clientID) + ",ou=user," + ServiceManager.getBaseDN();
        authSession.setProperty(Constants.UNIVERSAL_IDENTIFIER, id);
    }
    return authSession;
}
Also used : SessionException(com.iplanet.dpro.session.SessionException) Session(com.iplanet.dpro.session.Session) HttpSession(javax.servlet.http.HttpSession) InternalSession(com.iplanet.dpro.session.service.InternalSession)

Example 48 with SessionException

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

the class SessionCount method getSessionsFromPeerServers.

/*
     * Get user sessions from session repository
     */
private static Map getSessionsFromPeerServers(String uuid) {
    Map sessions = getSessionsFromLocalServer(uuid);
    String localServerID = serverConfig.getLocalServerID();
    Set serverIDs = null;
    try {
        serverIDs = WebtopNaming.getSiteNodes(localServerID);
    } catch (Exception e) {
        debug.error("Failed to get the serverIDs from " + "WebtopNaming.", e);
        return sessions;
    }
    for (Iterator m = serverIDs.iterator(); m.hasNext(); ) {
        String serverID = (String) m.next();
        if (serverID.equals(localServerID)) {
            continue;
        }
        try {
            URL svcurl = SESSION_SERVICE_URL_SERVICE.getSessionServiceURL(serverID);
            SessionRequest sreq = new SessionRequest(SessionRequest.GetSessionCount, getAdminToken().getTokenID().toString(), false);
            sreq.setUUID(uuid);
            SessionResponse sres = getSessionResponse(svcurl, sreq);
            sessions.putAll(sres.getSessionsForGivenUUID());
        } catch (SessionException se) {
            if (debug.messageEnabled()) {
                debug.message("SessionConstraint: " + "peer AM server is down...");
            }
        }
    }
    return sessions;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) SessionException(com.iplanet.dpro.session.SessionException) SessionResponse(com.iplanet.dpro.session.share.SessionResponse) HashMap(java.util.HashMap) Map(java.util.Map) SessionException(com.iplanet.dpro.session.SessionException) URL(java.net.URL) SessionRequest(com.iplanet.dpro.session.share.SessionRequest)

Example 49 with SessionException

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

the class SessionRequestHandler method forward.

private SessionResponse forward(URL svcurl, SessionRequest sreq) throws SessionException {
    try {
        Object context = RestrictedTokenContext.getCurrent();
        if (context != null) {
            sreq.setRequester(RestrictedTokenContext.marshal(context));
        }
        SessionResponse sres = sessionPLLSender.sendPLLRequest(svcurl, sreq);
        if (sres.getException() != null) {
            throw new SessionException(sres.getException());
        }
        return sres;
    } catch (SessionException se) {
        throw se;
    } catch (Exception ex) {
        throw new SessionException(ex);
    }
}
Also used : SessionException(com.iplanet.dpro.session.SessionException) SessionResponse(com.iplanet.dpro.session.share.SessionResponse) SessionException(com.iplanet.dpro.session.SessionException)

Example 50 with SessionException

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

the class CTSOperations method destroy.

/**
     * Perform a remote destroy operation on the SessionID, because we know this is a remote session.
     *
     * @param requester {@inheritDoc}
     * @param session {@inheritDoc}
     * @throws SessionException if we somehow passed a local session into this function
     */
@Override
public void destroy(Session requester, Session session) throws SessionException {
    // Comments as for logout.  The check for a local session should be removed if it proves to be a performance
    // bottleneck.
    //
    SessionID sessionID = session.getID();
    if (sessionService.checkSessionLocal(sessionID)) {
        throw new SessionException("CTSOperations received a local session (only remote sessions expected)");
    }
    remote.destroy(requester, session);
}
Also used : SessionException(com.iplanet.dpro.session.SessionException) SessionID(com.iplanet.dpro.session.SessionID)

Aggregations

SessionException (com.iplanet.dpro.session.SessionException)60 SessionID (com.iplanet.dpro.session.SessionID)22 Session (com.iplanet.dpro.session.Session)18 SSOException (com.iplanet.sso.SSOException)15 SessionResponse (com.iplanet.dpro.session.share.SessionResponse)9 SessionInfo (com.iplanet.dpro.session.share.SessionInfo)8 URL (java.net.URL)8 Map (java.util.Map)7 Test (org.testng.annotations.Test)7 InternalSession (com.iplanet.dpro.session.service.InternalSession)6 SessionRequest (com.iplanet.dpro.session.share.SessionRequest)6 IdRepoException (com.sun.identity.idm.IdRepoException)6 CoreTokenException (org.forgerock.openam.cts.exceptions.CoreTokenException)6 DelegationException (com.sun.identity.delegation.DelegationException)5 InterruptedIOException (java.io.InterruptedIOException)5 ConnectException (java.net.ConnectException)5 HashSet (java.util.HashSet)5 Set (java.util.Set)5 TokenRestriction (com.iplanet.dpro.session.TokenRestriction)4 SSOToken (com.iplanet.sso.SSOToken)4