Class ExtendedParameters
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.state.ExtendedParameters
-
public class ExtendedParameters extends Object
Created by Jeff Gaynor
on 2/18/20 at 7:14 AM
-
-
Field Summary
Fields Modifier and Type Field Description static String
CILOGON_NS
static String
EXTENDED_ATTRIBUTES_KEY
static String[]
NS_LIST
static String
OA4MP_NS
static String
PREFIX_DELIMITER
-
Constructor Summary
Constructors Constructor Description ExtendedParameters()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
flattenJSON(String namespace, net.sf.json.JSONObject cilogonEntry, net.sf.json.JSONObject j)
protected boolean
isExtendedAttribute(String x)
boolean
isInNamespace(String x)
static void
main(String[] args)
net.sf.json.JSONObject
snoopParameters(Map<String,String[]> pmap)
This does the grunt work of looking through parameters and pulling out the extended attributes.net.sf.json.JSONObject
toJSON(String rawKey, String[] rawValues)
This will take a raw parameter from a servlet of the form
NS:attr=val1,val2,val3,...
-
-
-
Method Detail
-
toJSON
public net.sf.json.JSONObject toJSON(String rawKey, String[] rawValues)
This will take a raw parameter from a servlet of the form
NS:attr=val1,val2,val3,...
and turn it in to a JSON object of the form
{"NS":{"attr":[val1,val2,val3,...]}}
These are then stored in the transaction if the client has extended attribute support allowed. Note that if there is no such parameter, then this return null;- Parameters:
rawKey
-rawValues
-- Returns:
-
isInNamespace
public boolean isInNamespace(String x)
-
isExtendedAttribute
protected boolean isExtendedAttribute(String x)
-
snoopParameters
public net.sf.json.JSONObject snoopParameters(Map<String,String[]> pmap)
This does the grunt work of looking through parameters and pulling out the extended attributes. The basic format of an entry isNS:/path=value0[,value1,...]
These parse into the extended attributes as{"NS0": {"key0_0":[values], "key0_1":[values],... }, "NS1": {"key1_0":[values], "key1_1":[values],... }, ... more entries }
where- NS is one of the approved namespaces for this client, e.g. oa4mp
- The key is of the form NS:key and there may be several keys. There may be arbitrarily many
- The values of each key is assumed to be a string array.
cilogon:roles/access=a,b --> {"cilogon":{"roles/access":["a","b"]}}
- Parameters:
pmap
- -- map of parameters from e.g. a servlet request- Returns:
-
flattenJSON
protected void flattenJSON(String namespace, net.sf.json.JSONObject cilogonEntry, net.sf.json.JSONObject j)
-
main
public static void main(String[] args)
-
-