Package org.oa4mp.client.api
Class ClientEnvironment
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.AbstractEnvironment
-
- org.oa4mp.delegation.client.AbstractClientEnvironment
-
- org.oa4mp.client.api.ClientEnvironment
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable,Serializable
public class ClientEnvironment extends AbstractClientEnvironment
Environment under which a client instance runs. Generally this is called by the loader and populated from the configuration file.Created by Jeff Gaynor
on May 16, 2011 at 3:27:56 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected URIaccessTokenUriprotected URIauthorizationUriprotected URIcallbackstatic StringCALLBACK_URI_KEYprotected Clientclientprotected javax.inject.Provider<Client>cpprotected StringerrorPagePathstatic StringFORM_ENCODINGprotected URIinitializeUriprotected StringprivKeyStringprotected StringredirectPagePathprotected URIresourceServerUriprotected Stringskinprotected StringsuccessPagePathprotected javax.inject.Provider<TokenForge>tfpstatic StringTOKEN-
Fields inherited from class org.oa4mp.delegation.client.AbstractClientEnvironment
CERT_LIFETIME_KEY, CERT_REQUEST_KEY
-
-
Constructor Summary
Constructors Constructor Description ClientEnvironment()ClientEnvironment(edu.uiuc.ncsa.security.core.util.MyLoggingFacade logger, Map<String,String> constants, URI accessTokenUri, URI authorizationUri, URI callback, URI initializeUri, URI resourceServerUri, long certLifetime, String clientId, PrivateKey privateKey, PublicKey publicKey, String skin, boolean enableAssetCleanup, long maxAssetLifetime, long keypairLifetime, AssetProvider assetProvider, javax.inject.Provider<Client> clientProvider, javax.inject.Provider<TokenForge> tokenForgeProvider, javax.inject.Provider<DelegationService> delegationServiceProvider, javax.inject.Provider<AssetStore> assetStoreProvider, boolean showRedirectPage, String errorPagePath, String redirectPagePath, String successPagePath, String kid, edu.uiuc.ncsa.security.util.jwk.JSONWebKeys jwks)Main constructor called by the loader.ClientEnvironment(URI accessTokenUri, URI authorizationUri, URI callback, long certLifetime, String clientId, DelegationService delegationService, URI initializeUri, PrivateKey privateKey, PublicKey publicKey, URI resourceServerUri, TokenForge tokenForge, AssetStore assetStore, boolean showRedirectPage, String errorPagePath, String redirectPagePath, String successPagePath, String keyID, edu.uiuc.ncsa.security.util.jwk.JSONWebKeys jwks)Used mostly for testing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URIgetAccessTokenUri()The endpoint for this client for retrieving an access token.AssetProvidergetAssetProvider()AssetStoregetAssetStore()Returns the configuredAssetStorefor this environment ornullif there is none.URIgetAuthorizationUri()The endpoint for this client allowing authorization of the user.URIgetCallback()The callback for this environment.
NOTE Generally this is specified in the configuration file and is the same for every request.longgetCertLifetime()The certificate lifetime request.ClientgetClient()AClientobject representing the instance of this service.StringgetClientId()The identifier for this client to the given server.DelegationServicegetDelegationService()TheOA4MPService, fully configured and operational.StringgetErrorPagePath()URIgetInitializeUri()The endpoint for this client that starts delegation.edu.uiuc.ncsa.security.util.jwk.JSONWebKeysgetJWKS()longgetKeypairLifetime()StringgetKid()longgetMaxAssetLifetime()PrivateKeygetPrivateKey()The private key for this client.protected StringgetPrivKeyString()Internal call to convert the private key.PublicKeygetPublicKey()The generated public key for this client.StringgetRedirectPagePath()URIgetResourceServerUri()The endpoint for this client for getting the resource (i.e., certificate chain).StringgetSkin()Optional skinning option.StringgetSuccessPagePath()TokenForgegetTokenForge()Internal call to the forge (a type of factory) that processing tokens returned from the server.booleanhasAssetStore()Returnstrueif a store has been configured for this environment andfalseotherwise.booleanhasJWKS()booleanhasKID()booleanisEnableAssetCleanup()booleanisShowRedirectPage()voidsetAssetProvider(AssetProvider assetProvider)voidsetCallback(URI callback)voidsetCertLifetime(long newCertLifetime)voidsetErrorPagePath(String errorPagePath)voidsetJWKS(edu.uiuc.ncsa.security.util.jwk.JSONWebKeys jwks)voidsetKid(String kid)voidsetRedirectPagePath(String redirectPagePath)voidsetSuccessPagePath(String successPagePath)
-
-
-
Field Detail
-
CALLBACK_URI_KEY
public static final String CALLBACK_URI_KEY
- See Also:
- Constant Field Values
-
TOKEN
public static final String TOKEN
- See Also:
- Constant Field Values
-
FORM_ENCODING
public static final String FORM_ENCODING
- See Also:
- Constant Field Values
-
accessTokenUri
protected URI accessTokenUri
-
authorizationUri
protected URI authorizationUri
-
initializeUri
protected URI initializeUri
-
resourceServerUri
protected URI resourceServerUri
-
callback
protected URI callback
-
privKeyString
protected String privKeyString
-
cp
protected javax.inject.Provider<Client> cp
-
tfp
protected javax.inject.Provider<TokenForge> tfp
-
client
protected Client client
-
skin
protected String skin
-
errorPagePath
protected String errorPagePath
-
successPagePath
protected String successPagePath
-
redirectPagePath
protected String redirectPagePath
-
-
Constructor Detail
-
ClientEnvironment
public ClientEnvironment()
-
ClientEnvironment
public ClientEnvironment(URI accessTokenUri, URI authorizationUri, URI callback, long certLifetime, String clientId, DelegationService delegationService, URI initializeUri, PrivateKey privateKey, PublicKey publicKey, URI resourceServerUri, TokenForge tokenForge, AssetStore assetStore, boolean showRedirectPage, String errorPagePath, String redirectPagePath, String successPagePath, String keyID, edu.uiuc.ncsa.security.util.jwk.JSONWebKeys jwks)
Used mostly for testing.- Parameters:
accessTokenUri-authorizationUri-callback-certLifetime-clientId-delegationService-initializeUri-privateKey-publicKey-resourceServerUri-tokenForge-assetStore-
-
ClientEnvironment
public ClientEnvironment(edu.uiuc.ncsa.security.core.util.MyLoggingFacade logger, Map<String,String> constants, URI accessTokenUri, URI authorizationUri, URI callback, URI initializeUri, URI resourceServerUri, long certLifetime, String clientId, PrivateKey privateKey, PublicKey publicKey, String skin, boolean enableAssetCleanup, long maxAssetLifetime, long keypairLifetime, AssetProvider assetProvider, javax.inject.Provider<Client> clientProvider, javax.inject.Provider<TokenForge> tokenForgeProvider, javax.inject.Provider<DelegationService> delegationServiceProvider, javax.inject.Provider<AssetStore> assetStoreProvider, boolean showRedirectPage, String errorPagePath, String redirectPagePath, String successPagePath, String kid, edu.uiuc.ncsa.security.util.jwk.JSONWebKeys jwks)Main constructor called by the loader.- Parameters:
logger-constants-accessTokenUri-authorizationUri-callback-initializeUri-resourceServerUri-certLifetime-clientId-privateKey-publicKey-clientProvider-tokenForgeProvider-delegationServiceProvider-assetStoreProvider-
-
-
Method Detail
-
hasJWKS
public boolean hasJWKS()
-
hasKID
public boolean hasKID()
-
getKid
public String getKid()
-
setKid
public void setKid(String kid)
-
getJWKS
public edu.uiuc.ncsa.security.util.jwk.JSONWebKeys getJWKS()
-
setJWKS
public void setJWKS(edu.uiuc.ncsa.security.util.jwk.JSONWebKeys jwks)
-
hasAssetStore
public boolean hasAssetStore()
Returnstrueif a store has been configured for this environment andfalseotherwise. Check this before using the store.- Returns:
-
getAssetStore
public AssetStore getAssetStore()
Returns the configuredAssetStorefor this environment ornullif there is none.- Returns:
- See Also:
hasAssetStore()
-
getAssetProvider
public AssetProvider getAssetProvider()
-
setAssetProvider
public void setAssetProvider(AssetProvider assetProvider)
-
getAccessTokenUri
public URI getAccessTokenUri()
The endpoint for this client for retrieving an access token.- Returns:
-
getAuthorizationUri
public URI getAuthorizationUri()
The endpoint for this client allowing authorization of the user.- Returns:
-
getInitializeUri
public URI getInitializeUri()
The endpoint for this client that starts delegation.- Returns:
-
getResourceServerUri
public URI getResourceServerUri()
The endpoint for this client for getting the resource (i.e., certificate chain).- Returns:
-
getTokenForge
public TokenForge getTokenForge()
Internal call to the forge (a type of factory) that processing tokens returned from the server. This is public merely because of java package limitations and generally is of no interest to developers.- Returns:
-
getDelegationService
public DelegationService getDelegationService()
TheOA4MPService, fully configured and operational.- Returns:
-
getCallback
public URI getCallback()
The callback for this environment.
NOTE Generally this is specified in the configuration file and is the same for every request. However, if a client wishes to have a different callback uri per request, simply reset this before each request as needed using thesetCallback(java.net.URI).- Returns:
-
setCallback
public void setCallback(URI callback)
-
getClientId
public String getClientId()
The identifier for this client to the given server. This is read from the configuration file and should not be changed.- Returns:
-
getPrivateKey
public PrivateKey getPrivateKey()
The private key for this client. This is specified in the configuration file and is used for signing request, not for certificate requests. it is paired with thegetPublicKey()- Returns:
-
getPublicKey
public PublicKey getPublicKey()
The generated public key for this client. This was supplied to the server at registration time. It is normally read from a configuration file.- Returns:
-
getPrivKeyString
protected String getPrivKeyString()
Internal call to convert the private key.- Returns:
-
getClient
public Client getClient()
AClientobject representing the instance of this service.- Returns:
-
getCertLifetime
public long getCertLifetime()
The certificate lifetime request. This is usually the same for every request and is specified in the client configuration file. It may be reset per request using thesetCertLifetime(long)- Returns:
-
setCertLifetime
public void setCertLifetime(long newCertLifetime)
-
getSkin
public String getSkin()
Optional skinning option. If the server supports a customized look and feel for a client, that will be used when this parameter is supplied.- Returns:
-
getKeypairLifetime
public long getKeypairLifetime()
-
getMaxAssetLifetime
public long getMaxAssetLifetime()
-
isEnableAssetCleanup
public boolean isEnableAssetCleanup()
-
isShowRedirectPage
public boolean isShowRedirectPage()
-
getErrorPagePath
public String getErrorPagePath()
-
setErrorPagePath
public void setErrorPagePath(String errorPagePath)
-
getSuccessPagePath
public String getSuccessPagePath()
-
setSuccessPagePath
public void setSuccessPagePath(String successPagePath)
-
getRedirectPagePath
public String getRedirectPagePath()
-
setRedirectPagePath
public void setRedirectPagePath(String redirectPagePath)
-
-