/**
   * 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);
    }
  }
Example #2
0
 /**
  * Returns the authentication service or chain configured for the given organization.
  *
  * @param orgDN organization DN.
  * @return the authentication service or chain configured for the given organization.
  */
 public String getOrgConfiguredAuthenticationChain(String orgDN) {
   String orgAuthConfig = null;
   try {
     OrganizationConfigManager orgConfigMgr = getOrgConfigManager(orgDN);
     ServiceConfig svcConfig = orgConfigMgr.getServiceConfig(ISAuthConstants.AUTH_SERVICE_NAME);
     Map attrs = svcConfig.getAttributes();
     orgAuthConfig = Misc.getMapAttr(attrs, ISAuthConstants.AUTHCONFIG_ORG);
   } catch (Exception e) {
     debug.error("Error in getOrgConfiguredAuthenticationChain : ", e);
   }
   return orgAuthConfig;
 }
  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);
      }
    }
  }
Example #4
0
 /**
  * Returns a list of domains defined by iplanet-am-auth-valid-goto-domains in iPlanetAMAuthService
  * plus organization aliases
  *
  * @param orgDN organization DN.
  * @return a Set object containing a list of valid domains, null if
  *     iplanet-am-auth-valid-goto-domains is empty.
  */
 private Set getValidGotoUrlDomains(String orgDN) {
   Set validGotoUrlDomains = null;
   try {
     OrganizationConfigManager orgConfigMgr = getOrgConfigManager(orgDN);
     ServiceConfig svcConfig = orgConfigMgr.getServiceConfig(ISAuthConstants.AUTH_SERVICE_NAME);
     Map attrs = svcConfig.getAttributes();
     validGotoUrlDomains = (Set) attrs.get(ISAuthConstants.AUTH_GOTO_DOMAINS);
     if (debug.messageEnabled()) {
       debug.message("AuthD.getValidGotoUrlDomains(): " + validGotoUrlDomains);
     }
   } catch (Exception e) {
     debug.error("AuthD.getValidGotoUrlDomains():" + "Error in getValidGotoUrlDomains : ", e);
   }
   return validGotoUrlDomains;
 }
Example #5
0
  private ServiceConfig getSocialAuthenticationServiceConfig(final String realm)
      throws SSOException, SMSException {

    ServiceConfig realmSocialAuthServiceConfig = realmSocialAuthServiceConfigMap.get(realm);
    if (realmSocialAuthServiceConfig == null || !realmSocialAuthServiceConfig.isValid()) {
      synchronized (realmSocialAuthServiceConfigMap) {
        realmSocialAuthServiceConfig = realmSocialAuthServiceConfigMap.get(realm);
        if (realmSocialAuthServiceConfig == null || !realmSocialAuthServiceConfig.isValid()) {
          SSOToken token = AccessController.doPrivileged(AdminTokenAction.getInstance());
          ServiceConfigManager mgr =
              new ServiceConfigManager(SocialAuthenticationImplementation.SERVICE_NAME, token);
          realmSocialAuthServiceConfig = mgr.getOrganizationConfig(realm, null);
          realmSocialAuthServiceConfigMap.put(realm, realmSocialAuthServiceConfig);
        }
      }
    }

    return realmSocialAuthServiceConfig;
  }
  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);
      }
    }
  }
Example #7
0
 /**
  * Default Constructor
  *
  * @param realm in which emails service shall be created
  */
 public MailServerImpl(String realm) {
   debug = Debug.getInstance("amMailServer");
   sendMail = new AMSendMail();
   try {
     mgr =
         new ServiceConfigManager(
             (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance()),
             SERVICE_NAME,
             SERVICE_VERSION);
     scm = mgr.getOrganizationConfig(realm, null);
     options = scm.getAttributes();
   } catch (Exception e) {
     debug.error("Cannot get ServiceConfigManager", e);
   }
 }