Пример #1
0
  /**
   * Perform a remote setProperty on the Session using the remote Service URL.
   *
   * <p>{@inheritDoc}
   */
  public void setProperty(Session session, String name, String value) throws SessionException {
    if (debug.messageEnabled()) {
      debug.message(MessageFormat.format("Remote setProperty {0} {1}={2}", session, name, value));
    }

    SessionID sessionID = session.getID();
    SessionRequest sreq =
        new SessionRequest(SessionRequest.SetProperty, sessionID.toString(), false);
    sreq.setPropertyName(name);
    sreq.setPropertyValue(value);
    if (SystemProperties.isServerMode() && InternalSession.isProtectedProperty(name)) {
      try {
        SSOToken admSSOToken = SessionUtils.getAdminToken();
        sreq.setRequester(RestrictedTokenContext.marshal(admSSOToken));
      } catch (SSOException e) {
        throw new SessionException(e);
      } catch (Exception e) {
        throw new SessionException(e);
      }

      if (debug.messageEnabled()) {
        debug.message(
            "Session.setProperty: "
                + "added admSSOToken in sreq to set "
                + "externalProtectedProperty in remote server");
      }
    }
    requests.sendRequestWithRetry(session.getSessionServiceURL(), sreq, session);
  }
Пример #2
0
  /**
   * Performs a logout operation by making a remote request based on the Sessions service URL.
   *
   * @param session Session to logout.
   */
  public void logout(Session session) throws SessionException {
    if (debug.messageEnabled()) {
      debug.message(MessageFormat.format("Remote logout {0}", session.getID().toString()));
    }

    SessionRequest sreq =
        new SessionRequest(SessionRequest.Logout, session.getID().toString(), false);
    requests.sendRequestWithRetry(session.getSessionServiceURL(), sreq, session);
  }
Пример #3
0
  /**
   * Destroys the Session via the Session remote service URL.
   *
   * @param requester {@inheritDoc}
   * @param session {@inheritDoc}
   * @throws SessionException {@inheritDoc}
   */
  public void destroy(Session requester, Session session) throws SessionException {
    if (debug.messageEnabled()) {
      debug.message(MessageFormat.format("Remote destroy {0}", session));
    }

    SessionRequest sreq =
        new SessionRequest(SessionRequest.DestroySession, requester.getID().toString(), false);
    sreq.setDestroySessionID(session.getID().toString());
    requests.sendRequestWithRetry(session.getSessionServiceURL(), sreq, session);
  }
Пример #4
0
  /**
   * @param session The Session to update.
   * @param reset If true, then update the last modified timestamp of the Session.
   * @return
   * @throws SessionException
   */
  public SessionInfo refresh(Session session, boolean reset) throws SessionException {
    SessionID sessionID = session.getID();
    if (debug.messageEnabled()) {
      debug.message(
          MessageFormat.format(
              "Remote fetch SessionInfo for {0}\n" + "Reset: {1}", sessionID, reset));
    }

    SessionRequest sreq =
        new SessionRequest(SessionRequest.GetSession, sessionID.toString(), reset);
    SessionResponse sres =
        requests.sendRequestWithRetry(session.getSessionServiceURL(), sreq, session);

    if (sres.getException() != null) {
      throw new SessionException(SessionBundle.rbName, INVALID_SESSION_STATE, null);
    }

    List<SessionInfo> infos = sres.getSessionInfo();
    if (infos.size() != 1) {
      throw new SessionException(SessionBundle.rbName, UNEXPECTED_SESSION, null);
    }
    return infos.get(0);
  }