Class BasicClaimsSourceImpl
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
-
- All Implemented Interfaces:
Serializable,org.oa4mp.delegation.server.server.claims.ClaimSource
- Direct Known Subclasses:
CodeClaimSource,FSClaimSource,HTTPHeaderClaimsSource,LDAPClaimsSource,QDLHeadersClaimsSource,TestClaimSource
public class BasicClaimsSourceImpl extends Object implements org.oa4mp.delegation.server.server.claims.ClaimSource
The most basic implementation of aClaimSource.Extending this class
If you want to write your own custom Java claim source and invoke it, you must extend this class and over-right the
realProcessing(JSONObject, HttpServletRequest, ServiceTransaction)method. Generally when claims are being gotten, the configuration that is created is passed along faithfully and you may access your custom parameters by invokingClaimSourceConfiguration.getProperty(String). An example is inTestClaimSource.Created by Jeff Gaynor
on 8/17/15 at 4:10 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected GroupHandlergroupHandler
-
Constructor Summary
Constructors Constructor Description BasicClaimsSourceImpl()BasicClaimsSourceImpl(OA2SE oa2SE)BasicClaimsSourceImpl(org.qdl_lang.variables.QDLStem stem)BasicClaimsSourceImpl(org.qdl_lang.variables.QDLStem stem, OA2SE oa2SE)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddToStem(org.qdl_lang.variables.QDLStem stem, String key, Object value)voidfromQDL(org.qdl_lang.variables.QDLStem stem)Collection<String>getClaims()returns a (unique) collection of claims.org.oa4mp.delegation.server.server.claims.ClaimSourceConfigurationgetConfiguration()GroupHandlergetGroupHandler()OA2SEgetOa2SE()Optionally, the service environment may be injected into a scope handler to get configuration of components, e.g.List<String>getOmitList()This is the list of claims from the headers to omit.Collection<String>getScopes()booleanhasConfiguration()booleanisEnabled()booleanisRunOnlyAtAuthorization()This should usually be false.net.sf.json.JSONObjectprocess(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, org.oa4mp.delegation.server.ServiceTransaction transaction)This also just returns theUserInfoobject passed in.net.sf.json.JSONObjectprocess(net.sf.json.JSONObject claims, org.oa4mp.delegation.server.ServiceTransaction transaction)At the most basic level, this just returns theUserInfoobject passed to it.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.voidsetConfiguration(org.oa4mp.delegation.server.server.claims.ClaimSourceConfiguration configuration)voidsetGroupHandler(GroupHandler groupHandler)voidsetOa2SE(OA2SE oa2SE)voidsetOmitList(List<String> omitList)voidsetScopes(Collection<String> scopes)org.qdl_lang.variables.QDLStemtoQDL()
-
-
-
Field Detail
-
groupHandler
protected GroupHandler groupHandler
-
-
Constructor Detail
-
BasicClaimsSourceImpl
public BasicClaimsSourceImpl(OA2SE oa2SE)
-
BasicClaimsSourceImpl
public BasicClaimsSourceImpl()
-
BasicClaimsSourceImpl
public BasicClaimsSourceImpl(org.qdl_lang.variables.QDLStem stem)
-
BasicClaimsSourceImpl
public BasicClaimsSourceImpl(org.qdl_lang.variables.QDLStem stem, OA2SE oa2SE)
-
-
Method Detail
-
getOmitList
public List<String> getOmitList()
This is the list of claims from the headers to omit. In other words, this module will reject these out of hand and never return them in a claims object. This is extremely useful in not having existing claims being over-written (which can happen if something like mod_auth_openidc is acting as an intermediary and adding spurious claims.)- Returns:
-
setConfiguration
public void setConfiguration(org.oa4mp.delegation.server.server.claims.ClaimSourceConfiguration configuration)
- Specified by:
setConfigurationin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
getConfiguration
public org.oa4mp.delegation.server.server.claims.ClaimSourceConfiguration getConfiguration()
- Specified by:
getConfigurationin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
hasConfiguration
public boolean hasConfiguration()
- Specified by:
hasConfigurationin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
getOa2SE
public OA2SE getOa2SE()
Optionally, the service environment may be injected into a scope handler to get configuration of components, e.g.- Returns:
-
setOa2SE
public void setOa2SE(OA2SE oa2SE)
-
getScopes
public Collection<String> getScopes()
- Specified by:
getScopesin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
process
public net.sf.json.JSONObject process(net.sf.json.JSONObject claims, org.oa4mp.delegation.server.ServiceTransaction transaction) throws org.oa4mp.delegation.server.server.UnsupportedScopeExceptionAt the most basic level, this just returns theUserInfoobject passed to it. Override as you deem fit.- Specified by:
processin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Parameters:
claims-transaction-- Returns:
- Throws:
org.oa4mp.delegation.server.server.UnsupportedScopeException
-
process
public net.sf.json.JSONObject process(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, org.oa4mp.delegation.server.ServiceTransaction transaction) throws org.oa4mp.delegation.server.server.UnsupportedScopeExceptionThis also just returns theUserInfoobject passed in. This has some legacy code. If you are writing a custom claim source, you really only need to invokerealProcessing(JSONObject, HttpServletRequest, ServiceTransaction)at the right time.- Specified by:
processin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Parameters:
claims-request-transaction-- Returns:
- Throws:
org.oa4mp.delegation.server.server.UnsupportedScopeException
-
getGroupHandler
public GroupHandler getGroupHandler()
-
setGroupHandler
public void setGroupHandler(GroupHandler groupHandler)
-
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.UnsupportedScopeExceptionThis is the actual place to put your code that only processes the claim source. Theprocess(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.- Parameters:
claims-request-transaction-- Returns:
- Throws:
org.oa4mp.delegation.server.server.UnsupportedScopeException
-
setScopes
public void setScopes(Collection<String> scopes)
- Specified by:
setScopesin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
getClaims
public Collection<String> getClaims()
returns a (unique) collection of claims.- Specified by:
getClaimsin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Returns:
-
isRunOnlyAtAuthorization
public boolean isRunOnlyAtAuthorization()
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:
isRunOnlyAtAuthorizationin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Returns:
-
fromQDL
public void fromQDL(org.qdl_lang.variables.QDLStem stem)
- Specified by:
fromQDLin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
toQDL
public org.qdl_lang.variables.QDLStem toQDL()
- Specified by:
toQDLin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource
-
-