private static void createOrgAuthConfig(String realmName) throws Exception {
  String classMethod="UpgradeUtils:createOrgAuthConfig: ";
  OrganizationConfigManager org=new OrganizationConfigManager(ssoToken,realmName);
  ServiceConfig orgConfig=org.getServiceConfig(AUTH_SERVICE_NAME);
  if (orgConfig != null) {
    Map aa=orgConfig.getAttributes();
    if (debug.messageEnabled()) {
      debug.message(classMethod + "Org is :" + realmName);
      debug.message(classMethod + "Attribute Map is :" + aa);
    }
    String orgName=realmName;
    if (LDAPUtils.isDN(realmName)) {
      orgName=LDAPUtils.rdnValueFromDn(realmName);
    }
    String authConfigName=orgName + "-authconfig";
    String adminAuthConfigName=orgName + "-admin-authconfig";
    Set authConfigAttrValue=(Set)aa.get(ATTR_ORG_AUTH_MODULE);
    if (debug.messageEnabled()) {
      debug.message(classMethod + "authConfigAttrValue : " + authConfigAttrValue);
    }
    Set newVal=new HashSet();
    if (authConfigAttrValue.size() != 1 && !authConfigAttrValue.contains(authConfigName)) {
      newVal.add(authConfigName);
      orgConfig.replaceAttributeValues(ATTR_ORG_AUTH_MODULE,authConfigAttrValue,newVal);
    }
    Set adminConfigAttrValue=(Set)aa.get(ATTR_ADMIN_AUTH_MODULE);
    if (debug.messageEnabled()) {
      debug.message("adminauthConfigAttrValue : " + adminConfigAttrValue);
    }
    if (adminConfigAttrValue.size() != 1 && !adminConfigAttrValue.contains(adminAuthConfigName)) {
      newVal.clear();
      newVal.add(adminAuthConfigName);
      orgConfig.replaceAttributeValues(ATTR_ADMIN_AUTH_MODULE,adminConfigAttrValue,newVal);
    }
    aa=orgConfig.getAttributes();
    ServiceConfig s=org.getServiceConfig(AUTH_CONFIG_SERVICE);
    ServiceConfig authConfig=s.getSubConfig(NAMED_CONFIG);
    if (authConfig == null) {
      s.addSubConfig(NAMED_CONFIG,null,0,null);
      authConfig=s.getSubConfig(NAMED_CONFIG);
    }
    Map aMap=new HashMap();
    aMap.put(ATTR_AUTH_CONFIG,authConfigAttrValue);
    authConfig.addSubConfig(authConfigName,SUB_NAMED_CONFIG,0,aMap);
    aMap.clear();
    aMap.put(ATTR_AUTH_CONFIG,adminConfigAttrValue);
    authConfig.addSubConfig(adminAuthConfigName,SUB_NAMED_CONFIG,0,aMap);
  }
}

private static void createOrgAuthConfig ( String realmName ) throws Exception { String classMethod = "UpgradeUtils:createOrgAuthConfig: " ; OrganizationConfigManager org = new OrganizationConfigManager ( ssoToken , realmName ) ; ServiceConfig orgConfig = org . getServiceConfig ( AUTH_SERVICE_NAME ) ; if ( orgConfig != null ) { Map aa = orgConfig . getAttributes ( ) ; if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "Org is :" + realmName ) ; debug . message ( classMethod + "Attribute Map is :" + aa ) ; } String orgName = realmName ; if ( LDAPUtils . isDN ( realmName ) ) { orgName = LDAPUtils . rdnValueFromDn ( realmName ) ; } String authConfigName = orgName + "-authconfig" ; String adminAuthConfigName = orgName + "-admin-authconfig" ; Set authConfigAttrValue = ( Set ) aa . get ( ATTR_ORG_AUTH_MODULE ) ; if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "authConfigAttrValue : " + authConfigAttrValue ) ; } Set newVal = new HashSet ( ) ; if ( authConfigAttrValue . size ( ) != 1 && ! authConfigAttrValue . contains ( authConfigName ) ) { newVal . add ( authConfigName ) ; orgConfig . replaceAttributeValues ( ATTR_ORG_AUTH_MODULE , authConfigAttrValue , newVal ) ; } Set adminConfigAttrValue = ( Set ) aa . get ( ATTR_ADMIN_AUTH_MODULE ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "adminauthConfigAttrValue : " + adminConfigAttrValue ) ; } if ( adminConfigAttrValue . size ( ) != 1 && ! adminConfigAttrValue . contains ( adminAuthConfigName ) ) { newVal . clear ( ) ; newVal . add ( adminAuthConfigName ) ; orgConfig . replaceAttributeValues ( ATTR_ADMIN_AUTH_MODULE , adminConfigAttrValue , newVal ) ; } aa = orgConfig . getAttributes ( ) ; ServiceConfig s = org . getServiceConfig ( AUTH_CONFIG_SERVICE ) ; ServiceConfig authConfig = s . getSubConfig ( NAMED_CONFIG ) ; if ( authConfig == null ) { s . addSubConfig ( NAMED_CONFIG , null , 0 , null ) ; authConfig = s . getSubConfig ( NAMED_CONFIG ) ; } Map aMap = new HashMap ( ) ; aMap . put ( ATTR_AUTH_CONFIG , authConfigAttrValue ) ; authConfig . addSubConfig ( authConfigName , SUB_NAMED_CONFIG , 0 , aMap ) ; aMap . clear ( ) ; aMap . put ( ATTR_AUTH_CONFIG , adminConfigAttrValue ) ; authConfig . addSubConfig ( adminAuthConfigName , SUB_NAMED_CONFIG , 0 , aMap ) ; } }
creates auth configurations for auth modules configuration in core auth service .
