Exemplo n.º 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);
  }
Exemplo n.º 2
0
  @Override
  public List<Entitlement> evaluate(
      final Subject adminSubject,
      final String realm,
      final Subject subject,
      final String applicationName,
      final String resourceName,
      final Set<String> actionNames,
      final Map<String, Set<String>> environment,
      final boolean recursive,
      final Object context)
      throws EntitlementException {
    List<Entitlement> results = null;

    try {
      results =
          (List<Entitlement>)
              RestrictedTokenContext.doUsing(
                  context,
                  new RestrictedTokenAction() {
                    public Object run() throws Exception {
                      return internalEvaluate(
                          adminSubject,
                          realm,
                          subject,
                          applicationName,
                          resourceName,
                          actionNames,
                          environment,
                          recursive);
                    }
                  });
    } catch (Exception ex) {
      // exception
    }

    return results;
  }