Class ExtendedParameters


  • public class ExtendedParameters
    extends Object

    Created by Jeff Gaynor
    on 2/18/20 at 7:14 AM

    • Field Detail

      • CILOGON_NS

        public static String CILOGON_NS
      • OA4MP_NS

        public static String OA4MP_NS
      • PREFIX_DELIMITER

        public static String PREFIX_DELIMITER
      • EXTENDED_ATTRIBUTES_KEY

        public static String EXTENDED_ATTRIBUTES_KEY
      • NS_LIST

        public static String[] NS_LIST
    • Constructor Detail

      • ExtendedParameters

        public ExtendedParameters()
    • 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 is
             NS:/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.
        For example
             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)