Class OA2Client
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.IdentifiableImpl
-
- edu.uiuc.ncsa.security.storage.monitored.Monitored
-
- org.oa4mp.delegation.common.storage.clients.BaseClient
-
- org.oa4mp.delegation.common.storage.clients.Client
-
- org.oa4mp.server.loader.oauth2.storage.clients.OA2Client
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.DateComparable,edu.uiuc.ncsa.security.core.Identifiable,Serializable,Cloneable,org.oa4mp.delegation.server.server.OA2ClientScopes
public class OA2Client extends Client implements org.oa4mp.delegation.server.server.OA2ClientScopes
OAuth2 Open ID connect protocol requires that sites register callback uris and that incoming requests must include a callback that matches one of the registered ones.Created by Jeff Gaynor
on 3/14/14 at 11:04 AM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected StringACCESS_TOKENS_KEYstatic StringCLIENT_COMMENT_TAGprotected Stringconfigstatic longDISABLE_REFRESH_TOKENSprotected net.sf.json.JSONObjectextended_attributesprotected StringID_TOKENS_KEYprotected net.sf.json.JSONObjectjsonConfigprotected Stringoa4mp_attributesprotected Stringoidc_cm_attributesprotected booleanpublicClientprotected StringREFRESH_TOKENS_KEYprotected StringTOKENS_KEYstatic longUSE_SERVER_DEFAULTprotected Stringxoauth_attributes
-
Constructor Summary
Constructors Constructor Description OA2Client(edu.uiuc.ncsa.security.core.Identifier identifier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OA2Clientclone()booleanequals(Object obj)AccessTokenConfiggetAccessTokensConfig()longgetAtLifetime()Collection<String>getAudience()Collection<String>getCallbackURIs()List<String>getComment()net.sf.json.JSONObjectgetConfig()The JSON configuration object.longgetDfInterval()longgetDfLifetime()net.sf.json.JSONObjectgetExtendedAttributes()Extended attributes base call.List<String>getGrantTypes()IDTokenClientConfiggetIDTokenConfig()longgetIdTokenLifetime()StringgetIssuer()Collection<org.oa4mp.delegation.server.server.config.LDAPConfiguration>getLdaps()longgetMaxATLifetime()The maximum lifetime, if different from the server max, for this client.longgetMaxIDTLifetime()longgetMaxRTLifetime()The maximum lifetime, if different from the server max, for this client.protected net.sf.json.JSONObjectgetNamedAttributes(String name)protected List<String>getNamedList(String component, String key)protected ObjectgetNamedProperty(String component, String key)protected net.sf.json.JSONObjectgetOA4MPAttributes()net.sf.json.JSONObjectgetOIDC_CM_Attributes()List<edu.uiuc.ncsa.security.core.Identifier>getPrototypes()Collection<String>getProxyClaimsList()This is a string that tells what claims in addition to the subject to take from the proxy claims.Collection<String>getProxyRequestScopes()Send the scopes explicitly in the client configuration, not the vetted scopes.StringgetRawConfig()RefreshTokenConfiggetRefreshTokensConfig()List<URI>getResource()List<String>getResponseTypes()longgetRtGracePeriod()longgetRtLifetime()protected net.sf.json.JSONObjectgetXOAuthExtendedAttributes()booleanhasAccessTokenConfig()booleanhasConfig()booleanhasDriverConfig()booleanhasExtendedAttributes()booleanhasExtendedAttributeSupport()Extended attributes refers to allowing the client pass in NS qualified additional parameters in the request.booleanhasIDTokenConfig()booleanhasOIDC_CM_Attributes()protected booleanhasPayloadConfig(String root, String path)booleanhasPrototypes()booleanhasRefreshTokenConfig()booleanhasRequestScopes()booleanhasScript()booleanisAllowPromptNone()booleanisErsatzClient()booleanisErsatzInheritIDToken()If this is an ersatz client, should it inherit the id token of its provisioner when forking the flow?booleanisExtendsProvisioners()If the ersatz client should simply extend all provisioners.booleanisForwardScopesToProxy()The scopes sentr to the proxy as the vetted scopes requested by the client.booleanisOIDCClient()booleanisPublicClient()booleanisRTLifetimeEnabled()This returns whether or not this client is configured to return refresh tokens.booleanisSignTokens()booleanisSkipServerScripts()static voidmain(String[] args)protected voidpopulateClone(BaseClient c)voidremoveOIDC_CM_Attributes()voidsetAccessTokenConfig(AccessTokenConfig cfg)voidsetAllowPromptNone(boolean allowPromptNone)voidsetAtLifetime(long atLifetime)voidsetAudience(Collection<String> audience)voidsetCallbackURIs(Collection<String> callbackURIs)voidsetComment(String comment)voidsetComment(List<String> comments)voidsetConfig(net.sf.json.JSONObject config)voidsetDfInterval(long dfInterval)voidsetDfLifetime(long dfLifetime)voidsetErsatzClient(boolean ersatzClient)voidsetErsatzInheritIDToken(boolean ersatzInheritIDToken)voidsetExtendedAttributes(net.sf.json.JSONObject eas)voidsetExtendedAttributeSupport(boolean b)voidsetExtendsProvisioners(boolean extendsProvisioners)voidsetForwardScopesToProxy(boolean forwardScopesToProxy)voidsetGrantTypes(List<String> grantTypes)voidsetIDTokenConfig(IDTokenClientConfig idTokenClientConfig)voidsetIdTokenLifetime(long idTokenLifetime)voidsetIssuer(String issuer)voidsetLdaps(Collection<org.oa4mp.delegation.server.server.config.LDAPConfiguration> ldaps)voidsetMaxATLifetime(long maxATLifetime)voidsetMaxIDTLifetime(long maxIDTLifetime)voidsetMaxRTLifetime(long maxRTLifetime)protected voidsetNamedAttributes(String name, net.sf.json.JSONObject jsonObject)protected voidsetNamedList(String component, String key, List<String> list)protected voidsetNamedProperty(String component, String key, Object property)voidsetOIDC_CM_attributes(net.sf.json.JSONObject attr)protected voidsetPayloadConfig(AbstractPayloadConfig apc, String root, String path)voidsetPrototypes(List<edu.uiuc.ncsa.security.core.Identifier> prototypes)voidsetProxyClaimsList(Collection<String> proxyClaimsList)voidsetProxyRequestScopes(Collection<String> proxyRequestScopes)voidsetPublicClient(boolean publicClient)voidsetRawConfig(String rawConfig)voidsetRefreshTokensConfig(RefreshTokenConfig refreshTokenConfig)voidsetResource(List<URI> resource)voidsetResponseTypes(List<String> responseTypes)voidsetRtGracePeriod(long rtGracePeriod)voidsetRtLifetime(long rtLifetime)voidsetSignTokens(boolean signTokens)voidsetSkipServerScripts(boolean skipServerScripts)voidsetStrictscopes(boolean newValue)protected AbstractPayloadConfigsetupPayloadConfig(AbstractPayloadConfig pc, String root, String path)StringtoString()booleanuseServerDefaultRTLifetime()booleanuseStrictScopes()Strict scopes means that the list of scopes must match exactly for the given client.-
Methods inherited from class org.oa4mp.delegation.common.storage.clients.Client
getErrorUri, getHomeUri, getScopes, isProxyLimited, setErrorUri, setHomeUri, setProxyLimited, setScopes
-
Methods inherited from class org.oa4mp.delegation.common.storage.clients.BaseClient
getCreationTS, getEmail, getJWKS, getJwksURI, getLastModifiedTS, getName, getSecret, getServiceClientUsers, hasJWKS, hasJWKSURI, hasServiceClientUsers, isDebugOn, isServiceClient, setCreationTS, setDebugOn, setEmail, setJWKS, setJwksURI, setLastModifiedTS, setName, setSecret, setServiceClient, setServiceClientUsers
-
Methods inherited from class edu.uiuc.ncsa.security.storage.monitored.Monitored
getLastAccessed, setLastAccessed
-
Methods inherited from class edu.uiuc.ncsa.security.core.util.IdentifiableImpl
getDescription, getIdentifier, getIdentifierString, isReadOnly, setDescription, setIdentifier, setReadOnly
-
-
-
-
Field Detail
-
USE_SERVER_DEFAULT
public static final long USE_SERVER_DEFAULT
- See Also:
- Constant Field Values
-
DISABLE_REFRESH_TOKENS
public static final long DISABLE_REFRESH_TOKENS
- See Also:
- Constant Field Values
-
publicClient
protected boolean publicClient
-
xoauth_attributes
protected String xoauth_attributes
-
oa4mp_attributes
protected String oa4mp_attributes
-
oidc_cm_attributes
protected String oidc_cm_attributes
-
TOKENS_KEY
protected String TOKENS_KEY
-
ACCESS_TOKENS_KEY
protected String ACCESS_TOKENS_KEY
-
REFRESH_TOKENS_KEY
protected String REFRESH_TOKENS_KEY
-
ID_TOKENS_KEY
protected String ID_TOKENS_KEY
-
CLIENT_COMMENT_TAG
public static String CLIENT_COMMENT_TAG
-
config
protected String config
-
jsonConfig
protected net.sf.json.JSONObject jsonConfig
-
extended_attributes
protected net.sf.json.JSONObject extended_attributes
-
-
Method Detail
-
clone
public OA2Client clone()
-
getMaxATLifetime
public long getMaxATLifetime()
The maximum lifetime, if different from the server max, for this client. Note that once set, no AT lifetime can exceed this. Set to <= 0 to use the server max. as the client max.- Returns:
-
setMaxATLifetime
public void setMaxATLifetime(long maxATLifetime)
-
getMaxRTLifetime
public long getMaxRTLifetime()
The maximum lifetime, if different from the server max, for this client. Note that once set, no RT lifetime can exceed this. Set to <= 0 to use the server max. as the client max.- Returns:
-
setMaxRTLifetime
public void setMaxRTLifetime(long maxRTLifetime)
-
populateClone
protected void populateClone(BaseClient c)
- Overrides:
populateClonein classClient
-
setComment
public void setComment(String comment)
-
getPrototypes
public List<edu.uiuc.ncsa.security.core.Identifier> getPrototypes()
-
setPrototypes
public void setPrototypes(List<edu.uiuc.ncsa.security.core.Identifier> prototypes)
-
hasPrototypes
public boolean hasPrototypes()
-
isErsatzClient
public boolean isErsatzClient()
-
setErsatzClient
public void setErsatzClient(boolean ersatzClient)
-
isExtendsProvisioners
public boolean isExtendsProvisioners()
If the ersatz client should simply extend all provisioners. This means you do not have to set thesetPrototypes(List)for this object. If you do set it, those will be processed first then the provisioners.- Returns:
-
setExtendsProvisioners
public void setExtendsProvisioners(boolean extendsProvisioners)
-
isSkipServerScripts
public boolean isSkipServerScripts()
-
setSkipServerScripts
public void setSkipServerScripts(boolean skipServerScripts)
-
isPublicClient
public boolean isPublicClient()
-
isOIDCClient
public boolean isOIDCClient()
-
setPublicClient
public void setPublicClient(boolean publicClient)
-
isSignTokens
public boolean isSignTokens()
-
setSignTokens
public void setSignTokens(boolean signTokens)
-
getIssuer
public String getIssuer()
-
setIssuer
public void setIssuer(String issuer)
-
getCallbackURIs
public Collection<String> getCallbackURIs()
-
setCallbackURIs
public void setCallbackURIs(Collection<String> callbackURIs)
-
getRtLifetime
public long getRtLifetime()
-
setRtLifetime
public void setRtLifetime(long rtLifetime)
-
getAtLifetime
public long getAtLifetime()
-
setAtLifetime
public void setAtLifetime(long atLifetime)
-
getIdTokenLifetime
public long getIdTokenLifetime()
-
setIdTokenLifetime
public void setIdTokenLifetime(long idTokenLifetime)
-
getMaxIDTLifetime
public long getMaxIDTLifetime()
-
setMaxIDTLifetime
public void setMaxIDTLifetime(long maxIDTLifetime)
-
isRTLifetimeEnabled
public boolean isRTLifetimeEnabled()
This returns whether or not this client is configured to return refresh tokens. Zero means no refresh tokens, positive is the lifetime, negativeUSE_SERVER_DEFAULTmeans to use the server default. Disabled means the lifetime is set to zero. See alsogetMaxRTLifetime()- Returns:
-
useServerDefaultRTLifetime
public boolean useServerDefaultRTLifetime()
-
getAudience
public Collection<String> getAudience()
-
setAudience
public void setAudience(Collection<String> audience)
-
getLdaps
public Collection<org.oa4mp.delegation.server.server.config.LDAPConfiguration> getLdaps()
-
setLdaps
public void setLdaps(Collection<org.oa4mp.delegation.server.server.config.LDAPConfiguration> ldaps)
-
setupPayloadConfig
protected AbstractPayloadConfig setupPayloadConfig(AbstractPayloadConfig pc, String root, String path)
-
setPayloadConfig
protected void setPayloadConfig(AbstractPayloadConfig apc, String root, String path)
-
hasAccessTokenConfig
public boolean hasAccessTokenConfig()
-
getAccessTokensConfig
public AccessTokenConfig getAccessTokensConfig()
-
hasDriverConfig
public boolean hasDriverConfig()
-
setAccessTokenConfig
public void setAccessTokenConfig(AccessTokenConfig cfg)
-
setRefreshTokensConfig
public void setRefreshTokensConfig(RefreshTokenConfig refreshTokenConfig)
-
hasRefreshTokenConfig
public boolean hasRefreshTokenConfig()
-
getRefreshTokensConfig
public RefreshTokenConfig getRefreshTokensConfig()
-
hasIDTokenConfig
public boolean hasIDTokenConfig()
-
getIDTokenConfig
public IDTokenClientConfig getIDTokenConfig()
-
setIDTokenConfig
public void setIDTokenConfig(IDTokenClientConfig idTokenClientConfig)
-
getNamedAttributes
protected net.sf.json.JSONObject getNamedAttributes(String name)
-
setNamedAttributes
protected void setNamedAttributes(String name, net.sf.json.JSONObject jsonObject)
-
hasOIDC_CM_Attributes
public boolean hasOIDC_CM_Attributes()
-
getOIDC_CM_Attributes
public net.sf.json.JSONObject getOIDC_CM_Attributes()
-
setOIDC_CM_attributes
public void setOIDC_CM_attributes(net.sf.json.JSONObject attr)
-
removeOIDC_CM_Attributes
public void removeOIDC_CM_Attributes()
-
getOA4MPAttributes
protected net.sf.json.JSONObject getOA4MPAttributes()
-
getXOAuthExtendedAttributes
protected net.sf.json.JSONObject getXOAuthExtendedAttributes()
-
hasExtendedAttributeSupport
public boolean hasExtendedAttributeSupport()
Extended attributes refers to allowing the client pass in NS qualified additional parameters in the request. Normally, these are ignored (as per spec). However, we can accept additional parameters (as per spec too), so if this is set to true, then those prefixed correctly will be added to the transaction for later processing. The default is false for this option.Note
These reside in the JSON configuration as part of a separate extra attributes object. So in the configuration you should have something like{"cfg":["comments"], "extraAttributes":{"extendedAttributesEnabled":true}, ... other stuff. }- Returns:
-
setExtendedAttributeSupport
public void setExtendedAttributeSupport(boolean b)
-
useStrictScopes
public boolean useStrictScopes()
Strict scopes means that the list of scopes must match exactly for the given client. Typically this isfalsefor WLCG and other clients that can pass in arbitrary scopes.- Returns:
-
setStrictscopes
public void setStrictscopes(boolean newValue)
-
getConfig
public net.sf.json.JSONObject getConfig()
The JSON configuration object. The format is as follows:{ "config":"comment", "claims":{"sources":[JSON], "logic":[JSON], "source_config":[JSON], "processing":[JSON]}, "sci_tokens":{"usernameClaimKey":"value", "templates":[...], "qdl":{...}}, "id_tokens":{"qdl":{...}}, "wlcg_token":{"qdl":{...}}, "isSaved":true|false }Note that the "claims" entry is deprecated and mostly refers to the old JFunctor scripting. Don't use in new configurations. The isSaved entry too relates to JFunctors and is ignored by all other components.
See the
ClientJSONConfigUtilJSON may be either a single JSON object or an array of them. If a single, it is converted to an array of a single object before processing.As of now (version 4.3), the claims block which is simple functor scripting is deprecated in favor of the new qdl block. JSON may be a logic block (which consists of various JSON functors.
{ "$if":conditionals, "$then":"actions", "$else":"other actions" }conditionals, actions and other actions are JSON objects or arrays of them as well. Note that the conditional must be a functor that evaluates to a logical value.
- Returns:
-
hasConfig
public boolean hasConfig()
-
setConfig
public void setConfig(net.sf.json.JSONObject config)
-
setRawConfig
public void setRawConfig(String rawConfig)
-
getRawConfig
public String getRawConfig()
-
getExtendedAttributes
public net.sf.json.JSONObject getExtendedAttributes()
Extended attributes base call. ThegetConfig()gets user-facing configuration, like scripts and maybe other things not related to OAuth. Extended attributes are for core configuration such as more grant types and such that come from specifications and are generally not open to change. The reason for this is simple: as OA4MP evolves, more and more attributes must be managed and rather than keep adding more database columns (and also have to update other store types too, with all the management that implies), just have a central place and leave all logic for them otherwise in software. Setters and getters are added to this class which store their information in a JSON blob.Structure
The structure is a flat list of attributes as:{ "xoauth_attributes":{"grant_type":[....}, <-- attributes for OAuth "oa4mp_attributes":{"foo":"bar",...} <-- attributes relating to OA4MP "oidc-cm":{"x":"y",...} <-- unused attributes RFC7951, so we have them ... etc }- Returns:
-
setExtendedAttributes
public void setExtendedAttributes(net.sf.json.JSONObject eas)
-
hasExtendedAttributes
public boolean hasExtendedAttributes()
-
main
public static void main(String[] args)
-
hasScript
public boolean hasScript()
-
getDfLifetime
public long getDfLifetime()
-
setDfLifetime
public void setDfLifetime(long dfLifetime)
-
getDfInterval
public long getDfInterval()
-
setDfInterval
public void setDfInterval(long dfInterval)
-
getProxyClaimsList
public Collection<String> getProxyClaimsList()
This is a string that tells what claims in addition to the subject to take from the proxy claims. Default is just to take the subject. Options are- (empty) - default = just take the sub claim
- [*] - all
- [c0, c1, c2,...] - a list
- Returns:
-
setProxyClaimsList
public void setProxyClaimsList(Collection<String> proxyClaimsList)
-
getProxyRequestScopes
public Collection<String> getProxyRequestScopes()
Send the scopes explicitly in the client configuration, not the vetted scopes.- Returns:
-
setProxyRequestScopes
public void setProxyRequestScopes(Collection<String> proxyRequestScopes)
-
hasRequestScopes
public boolean hasRequestScopes()
-
isForwardScopesToProxy
public boolean isForwardScopesToProxy()
The scopes sentr to the proxy as the vetted scopes requested by the client. This may include scopes for access or refresh tokens- Returns:
-
setForwardScopesToProxy
public void setForwardScopesToProxy(boolean forwardScopesToProxy)
-
getRtGracePeriod
public long getRtGracePeriod()
-
setRtGracePeriod
public void setRtGracePeriod(long rtGracePeriod)
-
isErsatzInheritIDToken
public boolean isErsatzInheritIDToken()
If this is an ersatz client, should it inherit the id token of its provisioner when forking the flow? If true, then yes, if false, then no.There are many times when the ersatz client needs some information in the id token of the provisioner (such as job id or other accounting information) and times when no information should be shared. Since this is generally undecideable, a flag si supplied.
- Returns:
-
setErsatzInheritIDToken
public void setErsatzInheritIDToken(boolean ersatzInheritIDToken)
-
isAllowPromptNone
public boolean isAllowPromptNone()
-
setAllowPromptNone
public void setAllowPromptNone(boolean allowPromptNone)
-
-