コード例 #1
0
  protected void checkMembershipValidity(RequestContext context) {

    VOMSUser u = context.getVOMSUser();
    VOMSRequest r = context.getRequest();

    if (u.isSuspended()) {
      failResponse(
          context,
          VOMSErrorMessage.suspendedUser(
              r.getHolderSubject(), r.getHolderIssuer(), u.getSuspensionReason()));
      context.setHandled(true);
      return;
    }

    Certificate cert = u.getCertificate(r.getHolderSubject(), r.getHolderIssuer());

    if (cert.isSuspended()) {
      failResponse(
          context,
          VOMSErrorMessage.suspendedCertificate(
              cert.getSubjectString(),
              cert.getCa().getSubjectString(),
              cert.getSuspensionReason()));
    }
  }
コード例 #2
0
  public void setUser(User user) throws RemoteException, VOMSException {

    log.info("setUser(" + StringUtils.join(new Object[] {user}, ',') + ");");

    if (user == null) throw new NullArgumentException("User passed as argument is null!");

    VOMSUser u = (VOMSUser) FindUserOperation.instance(user.getDN(), user.getCA()).execute();

    if (u == null)
      throw new NoSuchUserException(
          "User (" + user.getDN() + "," + user.getCA() + ") not found in database!");

    Validator.validateUser(user);

    u.fromUser(user);

    UpdateUserOperation.instance(u).execute();
  }
コード例 #3
0
  public User getUser(String username, String userca) throws RemoteException, VOMSException {

    log.info("getUser(" + StringUtils.join(new Object[] {username, userca}, ',') + ");");

    try {

      VOMSUser u = (VOMSUser) FindUserOperation.instance(username, userca).execute();

      if (u == null) return null;
      else return u.asUser();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);

      throw e;
    }
  }
コード例 #4
0
  public User[] listMembers(String groupname) throws RemoteException, VOMSException {

    log.info("listMembers(" + StringUtils.join(new Object[] {groupname}, ',') + ");");

    if (groupname == null || groupname.equals(""))
      groupname = "/" + VOMSConfiguration.instance().getVOName();

    try {

      List<VOMSUser> members = (List<VOMSUser>) ListMembersOperation.instance(groupname).execute();

      HibernateFactory.commitTransaction();

      return VOMSUser.collectionAsUsers(members);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #5
0
  public User[] listUsersWithRole(String groupname, String rolename)
      throws RemoteException, VOMSException {

    log.info(
        "listUsersWithRole(" + StringUtils.join(new Object[] {groupname, rolename}, ',') + ");");
    try {

      if (!PathNamingScheme.isRole(rolename)) rolename = "Role=" + rolename;

      String contextString = groupname + "/" + rolename;

      List members = (List) ListMembersOperation.instance(contextString).execute();

      HibernateFactory.commitTransaction();
      return VOMSUser.collectionAsUsers(members);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }