Class FSClaimSource
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
-
- org.oa4mp.server.loader.oauth2.claims.FSClaimSource
-
- All Implemented Interfaces:
ClaimSource
,Serializable
public class FSClaimSource extends BasicClaimsSourceImpl
A claim source backed by a file system. The file simply contains a JSON object of userids and attributes associated with that id. These are then returned as claims. Alternately, the JSON itself can just be set and used. This is how QDL utilities do it so they can fetch the JSON from a virtual file system.Created by Jeff Gaynor
on 10/21/19 at 12:49 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CLAIM_KEY
The id in the file that contains the default set of claims.static String
FILE_CLAIM_KEY
This is the name of the key in the claims to use.static String
FILE_PATH_KEY
The name of the property in the configuration that specifies where the file is that holds the claims for this source.static String
USE_DEFAULT_KEY
Boolean-valued claim.-
Fields inherited from class edu.uiuc.ncsa.myproxy.oa4mp.oauth2.claims.BasicClaimsSourceImpl
groupHandler
-
-
Constructor Summary
Constructors Constructor Description FSClaimSource(ClaimSourceConfiguration config)
FSClaimSource(edu.uiuc.ncsa.qdl.variables.QDLStem stem)
FSClaimSource(edu.uiuc.ncsa.qdl.variables.QDLStem stem, OA2SE oa2SE)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fromQDL(edu.uiuc.ncsa.qdl.variables.QDLStem stem)
String
getDefaultClaimName()
boolean
isRunAtAuthorization()
This should usually be false.boolean
isUseDefaultClaims()
protected String
readFile()
protected net.sf.json.JSONObject
realProcessing(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, ServiceTransaction transaction)
This is the actual place to put your code that only processes the claim source.void
setRawJSON(String rawJSON)
edu.uiuc.ncsa.qdl.variables.QDLStem
toQDL()
-
Methods inherited from class edu.uiuc.ncsa.myproxy.oa4mp.oauth2.claims.BasicClaimsSourceImpl
getClaims, getConfiguration, getGroupHandler, getOa2SE, getOmitList, getPostProcessor, getPreProcessor, getScopes, hasConfiguration, hasJSONPostProcessor, hasJSONPreProcessor, isEnabled, process, process, setConfiguration, setGroupHandler, setOa2SE, setOmitList, setScopes
-
-
-
-
Field Detail
-
FILE_PATH_KEY
public static String FILE_PATH_KEY
The name of the property in the configuration that specifies where the file is that holds the claims for this source.
-
FILE_CLAIM_KEY
public static String FILE_CLAIM_KEY
This is the name of the key in the claims to use. E.g. setting this to "sub" means the sub claim is used. It defaults to the username in the transaction if not set.
-
USE_DEFAULT_KEY
public static String USE_DEFAULT_KEY
Boolean-valued claim. If a user is not found, return a default record. This is useful if, e.g., this source contains a set of capabilites that are applied to more or less every user with a few exception.
-
DEFAULT_CLAIM_KEY
public static String DEFAULT_CLAIM_KEY
The id in the file that contains the default set of claims. Not that this is ignored unlessUSE_DEFAULT_KEY
is set.
-
-
Constructor Detail
-
FSClaimSource
public FSClaimSource(edu.uiuc.ncsa.qdl.variables.QDLStem stem)
-
FSClaimSource
public FSClaimSource(edu.uiuc.ncsa.qdl.variables.QDLStem stem, OA2SE oa2SE)
-
FSClaimSource
public FSClaimSource(ClaimSourceConfiguration config)
-
-
Method Detail
-
isUseDefaultClaims
public boolean isUseDefaultClaims()
-
getDefaultClaimName
public String getDefaultClaimName()
-
realProcessing
protected net.sf.json.JSONObject realProcessing(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, ServiceTransaction transaction) throws UnsupportedScopeException
Description copied from class:BasicClaimsSourceImpl
This is the actual place to put your code that only processes the claim source. TheBasicClaimsSourceImpl.process(JSONObject, HttpServletRequest, ServiceTransaction)
calls wrap this and invoke the pre/post processor for you. Your code should take whatever metadata is for the user and add it to the claims object.- Overrides:
realProcessing
in classBasicClaimsSourceImpl
- Returns:
- Throws:
UnsupportedScopeException
-
setRawJSON
public void setRawJSON(String rawJSON)
-
readFile
protected String readFile() throws IOException
- Throws:
IOException
-
isRunAtAuthorization
public boolean isRunAtAuthorization()
Description copied from class:BasicClaimsSourceImpl
This should usually be false. It is true only for those sources that can ONLY run at authorization, such asHTTPHeaderClaimsSource
, where the information is simply not available in later phases.- Specified by:
isRunAtAuthorization
in interfaceClaimSource
- Overrides:
isRunAtAuthorization
in classBasicClaimsSourceImpl
- Returns:
-
fromQDL
public void fromQDL(edu.uiuc.ncsa.qdl.variables.QDLStem stem)
- Specified by:
fromQDL
in interfaceClaimSource
- Overrides:
fromQDL
in classBasicClaimsSourceImpl
-
toQDL
public edu.uiuc.ncsa.qdl.variables.QDLStem toQDL()
- Specified by:
toQDL
in interfaceClaimSource
- Overrides:
toQDL
in classBasicClaimsSourceImpl
-
-