Package org.oa4mp.client.api.loader
Class AbstractClientLoader<T extends ClientEnvironment>
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.LoggingConfigLoader<T>
-
- org.oa4mp.delegation.common.servlet.DBConfigLoader<T>
-
- org.oa4mp.client.api.loader.AbstractClientLoader<T>
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.util.ConfigurationLoader<T>
,edu.uiuc.ncsa.security.core.Version
,Serializable
,ClientLoaderInterface<T>
- Direct Known Subclasses:
OA2ClientLoader
public abstract class AbstractClientLoader<T extends ClientEnvironment> extends DBConfigLoader<T> implements ClientLoaderInterface<T>
Top-level class for client loader that creates asset store and controls which classes are instantiated for the client.Created by Jeff Gaynor
on 11/25/13 at 1:12 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ASSET_ENDPOINT
protected javax.inject.Provider<AssetStore>
assetStoreProvider
static long
defaultCertLifetime
static long
defaultMaxAssetLifetime
protected javax.inject.Provider<DelegationService>
dsp
-
Fields inherited from class org.oa4mp.delegation.common.servlet.DBConfigLoader
derbyConnectionPoolProvider
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractClientLoader(org.apache.commons.configuration.tree.ConfigurationNode node)
protected
AbstractClientLoader(org.apache.commons.configuration.tree.ConfigurationNode node, edu.uiuc.ncsa.security.core.util.MyLoggingFacade logger)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkProtocol(String b)
Fix for OAUTH-107.protected URI
checkURI(String uri, String componentName)
Checks the uri.edu.uiuc.ncsa.security.servlet.ServiceClient
createServiceClient(URI host)
protected URI
createServiceURI(String foundURI, String endpoint, String wellKnownEntry)
Creates the service URI.protected URI
createServiceURIOLD(String foundURI, String baseUri, String serviceEndpoint)
Checks if there is a found uri in the configuration, i.e., an override to whatever the standard is.URI
getAccessTokenURI()
abstract AssetProvider
getAssetProvider()
javax.inject.Provider<AssetStore>
getAssetStoreProvider()
URI
getAssetURI()
URI
getAuthorizeURI()
URI
getCallback()
long
getCertLifetime()
protected String
getCfgValue(String key)
This takes a key and returns the value of the node associated with that key.protected abstract javax.inject.Provider<DelegationService>
getDSP()
String
getId()
URI
getIssuer()
long
getKeypairLifetime()
long
getMaxAssetLifetime()
String
getServiceURI()
String
getSkin()
edu.uiuc.ncsa.security.util.ssl.SSLConfiguration
getSSLConfiguration()
edu.uiuc.ncsa.security.servlet.ServiceClient
getWellKnownClient()
net.sf.json.JSONObject
getWellKnownConfiguration()
The well-known page from the server.String
getWellKnownString(String key)
Get the given value from the given key on the well-known page.String
getWellKnownURI()
Object
getWellKnownValue(String key)
Get a value form the well-known configuration which may be a JSON or other object.boolean
isEnableAssetCleanup()
T
load()
-
Methods inherited from class org.oa4mp.delegation.common.servlet.DBConfigLoader
getDerbyConnectionPoolProvider, getDerbyConnectionPoolProvider, getMariaDBConnectionPoolProvider, getMariaDBConnectionPoolProvider, getMySQLConnectionPoolProvider, getMySQLConnectionPoolProvider, getPgConnectionPoolProvider, getPgConnectionPoolProvider, isDefaultStoreDisabled
-
Methods inherited from class edu.uiuc.ncsa.security.core.util.LoggingConfigLoader
debug, getDebugger, getLoggerProvider, getMyLogger, getVersionString, info, setLoggerProvider, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.oa4mp.client.api.ClientLoaderInterface
getAdditionalParameters, getDeviceAuthorizationURI, getKeys, getKID, getRFC7009Endpoint, getRFC7662Endpoint, getScopes, getSecret, getServiceProvider, getUIURI, isOIDCEnabled
-
-
-
-
Field Detail
-
ASSET_ENDPOINT
public static final String ASSET_ENDPOINT
- See Also:
- Constant Field Values
-
defaultCertLifetime
public static final long defaultCertLifetime
- See Also:
- Constant Field Values
-
defaultMaxAssetLifetime
public static final long defaultMaxAssetLifetime
- See Also:
- Constant Field Values
-
assetStoreProvider
protected javax.inject.Provider<AssetStore> assetStoreProvider
-
dsp
protected javax.inject.Provider<DelegationService> dsp
-
-
Constructor Detail
-
AbstractClientLoader
protected AbstractClientLoader(org.apache.commons.configuration.tree.ConfigurationNode node)
-
AbstractClientLoader
protected AbstractClientLoader(org.apache.commons.configuration.tree.ConfigurationNode node, edu.uiuc.ncsa.security.core.util.MyLoggingFacade logger)
-
-
Method Detail
-
getAssetProvider
public abstract AssetProvider getAssetProvider()
-
getAssetStoreProvider
public javax.inject.Provider<AssetStore> getAssetStoreProvider()
- Specified by:
getAssetStoreProvider
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getDSP
protected abstract javax.inject.Provider<DelegationService> getDSP()
-
checkURI
protected URI checkURI(String uri, String componentName)
Checks the uri. The componentName is simply used for a more readable error messages if the uri is trivial or there is some syntax error with it.- Parameters:
uri
-componentName
-- Returns:
-
getCfgValue
protected String getCfgValue(String key)
This takes a key and returns the value of the node associated with that key. Returns null if no such value.- Parameters:
key
-- Returns:
-
getSkin
public String getSkin()
- Specified by:
getSkin
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getKeypairLifetime
public long getKeypairLifetime()
- Specified by:
getKeypairLifetime
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getMaxAssetLifetime
public long getMaxAssetLifetime()
- Specified by:
getMaxAssetLifetime
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
isEnableAssetCleanup
public boolean isEnableAssetCleanup()
- Specified by:
isEnableAssetCleanup
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
createServiceURIOLD
protected URI createServiceURIOLD(String foundURI, String baseUri, String serviceEndpoint)
Checks if there is a found uri in the configuration, i.e., an override to whatever the standard is. If so, check that and use it, if not, try and construct the service endpoint from the base uri and the default serviceEndpoint.- Parameters:
foundURI
-baseUri
-serviceEndpoint
-- Returns:
-
createServiceURI
protected URI createServiceURI(String foundURI, String endpoint, String wellKnownEntry)
Creates the service URI. This takes- The tag in the configuration file
- The default endpoint name (used to construct error messages)
- The key in the well-known page to get the value from.
- Parameters:
foundURI
-endpoint
-wellKnownEntry
-- Returns:
-
getCertLifetime
public long getCertLifetime()
- Specified by:
getCertLifetime
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getId
public String getId()
- Specified by:
getId
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getCallback
public URI getCallback()
- Specified by:
getCallback
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
checkProtocol
protected void checkProtocol(String b)
Fix for OAUTH-107. Check that the protocols are indeed https as per spec at client loading rather than wait for a much later error from a server possibly trying to do a redirect. It is ok for the argument to be null, since that just means that a (correct) address will be created. This is to find mis-specified service addresses.- Parameters:
b
-
-
getServiceURI
public String getServiceURI()
- Specified by:
getServiceURI
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getWellKnownURI
public String getWellKnownURI()
- Specified by:
getWellKnownURI
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getAccessTokenURI
public URI getAccessTokenURI()
- Specified by:
getAccessTokenURI
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getAssetURI
public URI getAssetURI()
- Specified by:
getAssetURI
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getIssuer
public URI getIssuer()
- Specified by:
getIssuer
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
getAuthorizeURI
public URI getAuthorizeURI()
- Specified by:
getAuthorizeURI
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
load
public T load()
- Specified by:
load
in interfaceedu.uiuc.ncsa.security.core.util.ConfigurationLoader<T extends ClientEnvironment>
-
getSSLConfiguration
public edu.uiuc.ncsa.security.util.ssl.SSLConfiguration getSSLConfiguration()
- Specified by:
getSSLConfiguration
in interfaceClientLoaderInterface<T extends ClientEnvironment>
-
createServiceClient
public edu.uiuc.ncsa.security.servlet.ServiceClient createServiceClient(URI host)
-
getWellKnownClient
public edu.uiuc.ncsa.security.servlet.ServiceClient getWellKnownClient()
-
getWellKnownString
public String getWellKnownString(String key)
Get the given value from the given key on the well-known page. This just return strings. If there is no such value, a null is returned. If the response is incorrect, an exception is thrown.- Parameters:
key
-- Returns:
-
getWellKnownValue
public Object getWellKnownValue(String key)
Get a value form the well-known configuration which may be a JSON or other object. You have to process it once you have it.- Parameters:
key
-- Returns:
-
getWellKnownConfiguration
public net.sf.json.JSONObject getWellKnownConfiguration()
The well-known page from the server. Cache this or every call for a configuration value can require a trip to the server. The well-known page should rarely change, so this is completely reasonable.- Returns:
-
-