Class OA2ClientFunctorScriptsUtil
- java.lang.Object
-
- org.oa4mp.delegation.server.scripts.server.ClientJSONConfigUtil
-
- org.oa4mp.delegation.server.functor.scripts.server.ClientFunctorScriptsUtil
-
- org.oa4mp.server.loader.oauth2.state.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
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OA2ClientFunctorScriptsUtil.SourceEntry
-
Field Summary
Fields Modifier and Type Field Description static String
CLAIM_SOURCE_ALIAS_KEY
static String
CLAIM_SOURCE_CLASSNAME_KEY
Note that this cannot be the reserved word "class" since the JSON library will attempt to resolve it to a class and do squirrelly things with it if it finds one.static String
CLAIM_SOURCE_CONFIG_KEY
static String
CLAIM_SOURCES_KEY
static String
CLAIMS_KEY
static String
CONFIG_KEY
-
Fields inherited from class edu.uiuc.ncsa.oa4mp.delegation.oa2.server.scripts.functor.ClientFunctorScriptsUtil
CLAIM_POST_PROCESSING_KEY, CLAIM_PRE_PROCESSING_KEY, RUNTIME_KEY
-
Fields inherited from class edu.uiuc.ncsa.oa4mp.delegation.oa2.server.scripts.ClientJSONConfigUtil
COMMENT_KEY, SAVED_KEY
-
-
Constructor Summary
Constructors Constructor Description OA2ClientFunctorScriptsUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.protected static void
createDefaultPreProcessor(net.sf.json.JSONObject config, String newName)
static net.sf.json.JSONArray
getClaimSourceConfigurations(net.sf.json.JSONObject config)
static net.sf.json.JSONArray
getClaimSources(net.sf.json.JSONObject config)
static net.sf.json.JSONObject
getClaimsPostProcessing(net.sf.json.JSONObject config)
static net.sf.json.JSONObject
getClaimsPreProcessing(net.sf.json.JSONObject config)
protected static net.sf.json.JSONObject
getClaimsProcessor(net.sf.json.JSONObject config, String key)
protected static net.sf.json.JSONArray
getClaimsThingy(net.sf.json.JSONObject config, String key)
static boolean
hasClaimPostProcessor(net.sf.json.JSONObject config)
static boolean
hasClaimPreProcessor(net.sf.json.JSONObject config)
static boolean
hasClaimSourceConfigurations(net.sf.json.JSONObject config)
static boolean
hasClaimSources(net.sf.json.JSONObject config)
protected static boolean
hasClaimsThingy(String key, net.sf.json.JSONObject config)
static void
setClaimSources(net.sf.json.JSONObject config, net.sf.json.JSONArray claimsSources)
static void
setClaimSourcesConfigurations(net.sf.json.JSONObject config, net.sf.json.JSONArray sourceConfigs)
static void
setClaimsPostProcessing(net.sf.json.JSONObject config, net.sf.json.JSONObject processing)
static void
setClaimsPreProcessing(net.sf.json.JSONObject config, net.sf.json.JSONObject processing)
protected static void
setClaimsThingy(net.sf.json.JSONObject config, String key, net.sf.json.JSON thingy)
static Map<String,OA2ClientFunctorScriptsUtil.SourceEntry>
toSourcesMap(net.sf.json.JSONArray array)
Method to pull the sources from the array of {"alias":A,"className":B} objectsstatic Map<String,OA2ClientFunctorScriptsUtil.SourceEntry>
toSourcesMap(net.sf.json.JSONObject json)
Convenience method to pull the sources from a the whole configuration-
Methods inherited from class edu.uiuc.ncsa.oa4mp.delegation.oa2.server.scripts.functor.ClientFunctorScriptsUtil
getProcessor, getRuntime, getRuntimeArg, hasRuntime, setRuntime
-
Methods inherited from class edu.uiuc.ncsa.oa4mp.delegation.oa2.server.scripts.ClientJSONConfigUtil
getComment, getThingies, getThingy, hasThingy, setComment, setComment, setThingy
-
-
-
-
Field Detail
-
CONFIG_KEY
public static final String CONFIG_KEY
- See Also:
- Constant Field Values
-
CLAIMS_KEY
public static final String CLAIMS_KEY
- See Also:
- Constant Field Values
-
CLAIM_SOURCES_KEY
public static final String CLAIM_SOURCES_KEY
- See Also:
- Constant Field Values
-
CLAIM_SOURCE_CONFIG_KEY
public static final String CLAIM_SOURCE_CONFIG_KEY
- See Also:
- Constant Field Values
-
CLAIM_SOURCE_CLASSNAME_KEY
public static final String CLAIM_SOURCE_CLASSNAME_KEY
Note that this cannot be the reserved word "class" since the JSON library will attempt to resolve it to a class and do squirrelly things with it if it finds one.- See Also:
- Constant Field Values
-
CLAIM_SOURCE_ALIAS_KEY
public static final String CLAIM_SOURCE_ALIAS_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
toSourcesMap
public static Map<String,OA2ClientFunctorScriptsUtil.SourceEntry> toSourcesMap(net.sf.json.JSONObject json)
Convenience method to pull the sources from a the whole configuration- Parameters:
json
-- Returns:
-
toSourcesMap
public static Map<String,OA2ClientFunctorScriptsUtil.SourceEntry> toSourcesMap(net.sf.json.JSONArray array)
Method to pull the sources from the array of {"alias":A,"className":B} objects- Parameters:
array
-- Returns:
-
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)
-
-