Class OA2ClientFunctorScriptsUtil


  • public class OA2ClientFunctorScriptsUtil
    extends ClientFunctorScriptsUtil
    This helps work with the configuration for a client. The basic format is
        {"config":"comment",
          "claims":{
             "runtime":[...],
             "sources:[{"alias":"A","className":"B"},...],
             "sourcesConfig":[{config1,...}],
             "preProcessing":[],
             "postProcessing":[]
          }
        }*
     
    Where
    • sources= list of aliases and class names,
    • sourceConfig = configurations corresponding to the sources
    • preProcessing = directives to run before the claims have been obtained
    • postProcessing = directives to run after the claims have been obtained
    and
         runtime = directives to run before any processing. E.g. A condition to determine if claims are to be gotten.
     
    The sourcesConfigurations are a list of configurations for the claim sources. This allows for multiple configurations to be used (e,g. depending on the IDP, specific LDAP claim sources will be invoked.)

    Created by Jeff Gaynor
    on 4/12/18 at 8:16 AM

    • Constructor Detail

      • OA2ClientFunctorScriptsUtil

        public OA2ClientFunctorScriptsUtil()
    • Method Detail

      • getClaimSources

        public static net.sf.json.JSONArray getClaimSources​(net.sf.json.JSONObject config)
      • setClaimSources

        public static void setClaimSources​(net.sf.json.JSONObject config,
                                           net.sf.json.JSONArray claimsSources)
      • getClaimsThingy

        protected static net.sf.json.JSONArray getClaimsThingy​(net.sf.json.JSONObject config,
                                                               String key)
      • getClaimsProcessor

        protected static net.sf.json.JSONObject getClaimsProcessor​(net.sf.json.JSONObject config,
                                                                   String key)
      • setClaimsThingy

        protected static void setClaimsThingy​(net.sf.json.JSONObject config,
                                              String key,
                                              net.sf.json.JSON thingy)
      • hasClaimPreProcessor

        public static boolean hasClaimPreProcessor​(net.sf.json.JSONObject config)
      • hasClaimPostProcessor

        public static boolean hasClaimPostProcessor​(net.sf.json.JSONObject config)
      • hasClaimSources

        public static boolean hasClaimSources​(net.sf.json.JSONObject config)
      • hasClaimSourceConfigurations

        public static boolean hasClaimSourceConfigurations​(net.sf.json.JSONObject config)
      • hasClaimsThingy

        protected static boolean hasClaimsThingy​(String key,
                                                 net.sf.json.JSONObject config)
      • getClaimSourceConfigurations

        public static net.sf.json.JSONArray getClaimSourceConfigurations​(net.sf.json.JSONObject config)
      • setClaimSourcesConfigurations

        public static void setClaimSourcesConfigurations​(net.sf.json.JSONObject config,
                                                         net.sf.json.JSONArray sourceConfigs)
      • getClaimsPostProcessing

        public static net.sf.json.JSONObject getClaimsPostProcessing​(net.sf.json.JSONObject config)
      • setClaimsPostProcessing

        public static void setClaimsPostProcessing​(net.sf.json.JSONObject config,
                                                   net.sf.json.JSONObject processing)
      • getClaimsPreProcessing

        public static net.sf.json.JSONObject getClaimsPreProcessing​(net.sf.json.JSONObject config)
      • setClaimsPreProcessing

        public static void setClaimsPreProcessing​(net.sf.json.JSONObject config,
                                                  net.sf.json.JSONObject processing)
      • convertToNewConfiguration

        public static net.sf.json.JSONObject convertToNewConfiguration​(net.sf.json.JSONObject oldLDAP,
                                                                       net.sf.json.JSONObject config)
        This will take the old LDAP object and convert it to the new configuration format. It does this by creating a new entry with a distinguished name. If that exists in the new config, then it is assumed that this has been done.

        To migrate an old claim source configuration (only LDAP was explicitly supported you must either)

        • let this run (it will be invoked automatically)
        • explicitly migrate the old configuration by hand and set up a corresponding conditional.
        Parameters:
        oldLDAP - the raw JSON of the old LDAP configuration in the store. Delete this from the store when done!
        config - the new configuration object
        Returns:
      • createDefaultPreProcessor

        protected static void createDefaultPreProcessor​(net.sf.json.JSONObject config,
                                                        String newName)