Class FSClaimSource
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
-
- org.oa4mp.server.loader.oauth2.claims.FSClaimSource
-
- All Implemented Interfaces:
Serializable,org.oa4mp.delegation.server.server.claims.ClaimSource
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 StringDEFAULT_ALL_CLAIMS_KEYThe key if the claims were read fromstatic StringDEFAULT_CLAIM_KEYThe id in the file that contains the default set of claims.static StringFILE_CLAIM_KEYThis is the name of the key in the claims to use.static StringFILE_PATH_KEYThe name of the property in the configuration that specifies where the file is that holds the claims for this source.static StringUSE_DEFAULT_KEYBoolean-valued claim.-
Fields inherited from class org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
groupHandler
-
-
Constructor Summary
Constructors Constructor Description FSClaimSource(org.oa4mp.delegation.server.server.claims.ClaimSourceConfiguration config)FSClaimSource(org.qdl_lang.variables.QDLStem stem)FSClaimSource(org.qdl_lang.variables.QDLStem stem, OA2SE oa2SE)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfromQDL(org.qdl_lang.variables.QDLStem stem)StringgetDefaultClaimName()booleanisRunOnlyAtAuthorization()This should usually be false.booleanisUseDefaultClaims()protected StringreadFile()protected net.sf.json.JSONObjectrealProcessing(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, org.oa4mp.delegation.server.ServiceTransaction transaction)This is the actual place to put your code that only processes the claim source.voidsetRawJSON(String rawJSON)org.qdl_lang.variables.QDLStemtoQDL()-
Methods inherited from class org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
addToStem, getClaims, getConfiguration, getGroupHandler, getOa2SE, getOmitList, getScopes, hasConfiguration, 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_KEYis set.
-
DEFAULT_ALL_CLAIMS_KEY
public static String DEFAULT_ALL_CLAIMS_KEY
The key if the claims were read from
-
-
Constructor Detail
-
FSClaimSource
public FSClaimSource(org.qdl_lang.variables.QDLStem stem)
-
FSClaimSource
public FSClaimSource(org.qdl_lang.variables.QDLStem stem, OA2SE oa2SE)
-
FSClaimSource
public FSClaimSource(org.oa4mp.delegation.server.server.claims.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, org.oa4mp.delegation.server.ServiceTransaction transaction) throws org.oa4mp.delegation.server.server.UnsupportedScopeExceptionDescription copied from class:BasicClaimsSourceImplThis 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:
realProcessingin classBasicClaimsSourceImpl- Returns:
- Throws:
org.oa4mp.delegation.server.server.UnsupportedScopeException
-
setRawJSON
public void setRawJSON(String rawJSON)
-
readFile
protected String readFile() throws IOException
- Throws:
IOException
-
isRunOnlyAtAuthorization
public boolean isRunOnlyAtAuthorization()
Description copied from class:BasicClaimsSourceImplThis 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:
isRunOnlyAtAuthorizationin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
isRunOnlyAtAuthorizationin classBasicClaimsSourceImpl
-
fromQDL
public void fromQDL(org.qdl_lang.variables.QDLStem stem)
- Specified by:
fromQDLin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
fromQDLin classBasicClaimsSourceImpl
-
toQDL
public org.qdl_lang.variables.QDLStem toQDL()
- Specified by:
toQDLin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
toQDLin classBasicClaimsSourceImpl
-
-