/**
   * Returns available subject attribute names.
   *
   * @return a set of available subject attribute names or null if not found
   */
  public Set<String> getAvailableSubjectAttributeNames() throws EntitlementException {

    try {
      ServiceConfig sc = idRepoServiceConfigManager.getOrganizationConfig(realm, null);
      if (sc == null) {
        return null;
      }
      Set subConfigNames = sc.getSubConfigNames();
      if ((subConfigNames == null) || (subConfigNames.isEmpty())) {
        return null;
      }

      CaseInsensitiveHashSet result = null;

      for (Iterator iter = subConfigNames.iterator(); iter.hasNext(); ) {
        String idRepoName = (String) iter.next();
        ServiceConfig reposc = sc.getSubConfig(idRepoName);
        Map attrMap = reposc.getAttributesForRead();
        Set userAttrs = (Set) attrMap.get(LDAPv3Config_USER_ATTR);
        if ((userAttrs != null) && (!userAttrs.isEmpty())) {
          if (result == null) {
            result = new CaseInsensitiveHashSet();
          }
          result.addAll(userAttrs);
        }
      }

      return result;
    } catch (SMSException e) {
      throw new EntitlementException(602, e);
    } catch (SSOException e) {
      throw new EntitlementException(602, e);
    }
  }
Exemplo n.º 2
0
  private void deleteSubConfig(ServiceConfig sc, String subConfigName)
      throws SSOException, SMSException {
    StringTokenizer st = new StringTokenizer(subConfigName, "/");
    int tokenCount = st.countTokens();

    for (int i = 1; i <= tokenCount; i++) {
      String scn = SMSSchema.unescapeName(st.nextToken());

      if (i != tokenCount) {
        sc = sc.getSubConfig(scn);
      } else {
        sc.removeSubConfig(scn);
      }
    }
  }
Exemplo n.º 3
0
  private void addSubConfig(
      ServiceConfig sc, String subConfigName, String subConfigId, Map attrValues, int priority)
      throws SSOException, SMSException {
    StringTokenizer st = new StringTokenizer(subConfigName, "/");
    int tokenCount = st.countTokens();

    for (int i = 1; i <= tokenCount; i++) {
      String scn = SMSSchema.unescapeName(st.nextToken());

      if (i != tokenCount) {
        sc = sc.getSubConfig(scn);
      } else {
        if (subConfigId == null) {
          subConfigId = scn;
        }

        sc.addSubConfig(subConfigId, scn, priority, attrValues);
      }
    }
  }