Class ClientEnvironment
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.AbstractEnvironment
-
- edu.uiuc.ncsa.oa4mp.delegation.client.AbstractClientEnvironment
-
- edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable
- Direct Known Subclasses:
OA2ClientEnvironment
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
-
-
Field Summary
Fields Modifier and Type Field Description protected URI
accessTokenUri
protected URI
authorizationUri
protected URI
callback
static String
CALLBACK_URI_KEY
protected Client
client
protected javax.inject.Provider<Client>
cp
protected String
errorPagePath
static String
FORM_ENCODING
protected URI
initializeUri
protected String
privKeyString
protected String
redirectPagePath
protected URI
resourceServerUri
protected String
skin
protected String
successPagePath
protected javax.inject.Provider<TokenForge>
tfp
static String
TOKEN
static String
VERIFIER
-
Fields inherited from class edu.uiuc.ncsa.oa4mp.delegation.client.AbstractClientEnvironment
CERT_LIFETIME_KEY, CERT_REQUEST_KEY
-
-
Constructor Summary
Constructors Constructor Description 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)
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)
Used mostly for testing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URI
getAccessTokenUri()
The endpoint for this client for retrieving an access token.AssetProvider
getAssetProvider()
AssetStore
getAssetStore()
Returns the configuredAssetStore
for this environment ornull
if there is none.URI
getAuthorizationUri()
The endpoint for this client allowing authorization of the user.URI
getCallback()
The callback for this environment.
NOTE Generally this is specified in the configuration file and is the same for every request.long
getCertLifetime()
The certificate lifetime request.Client
getClient()
AClient
object representing the instance of this service.String
getClientId()
The identifier for this client to the given server.DelegationService
getDelegationService()
TheOA4MPService
, fully configured and operational.String
getErrorPagePath()
URI
getInitializeUri()
The endpoint for this client that starts delegation.long
getKeypairLifetime()
long
getMaxAssetLifetime()
PrivateKey
getPrivateKey()
The private key for this client.protected String
getPrivKeyString()
Internal call to convert the private key.PublicKey
getPublicKey()
The generated public key for this client.String
getRedirectPagePath()
URI
getResourceServerUri()
The endpoint for this client for getting the resource (i.e., certificate chain).String
getSkin()
Optional skinning option.String
getSuccessPagePath()
TokenForge
getTokenForge()
Internal call to the forge (a type of factory) that processing tokens returned from the server.boolean
hasAssetStore()
Returnstrue
if a store has been configured for this environment andfalse
otherwise.boolean
isEnableAssetCleanup()
boolean
isShowRedirectPage()
void
setAssetProvider(AssetProvider assetProvider)
void
setCallback(URI callback)
void
setCertLifetime(long newCertLifetime)
void
setErrorPagePath(String errorPagePath)
void
setRedirectPagePath(String redirectPagePath)
void
setSuccessPagePath(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
-
VERIFIER
public static final String VERIFIER
- 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(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)
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)
Main constructor called by the loader.- Parameters:
logger
-constants
-accessTokenUri
-authorizationUri
-callback
-initializeUri
-resourceServerUri
-certLifetime
-clientId
-privateKey
-publicKey
-clientProvider
-tokenForgeProvider
-delegationServiceProvider
-assetStoreProvider
-
-
-
Method Detail
-
hasAssetStore
public boolean hasAssetStore()
Returnstrue
if a store has been configured for this environment andfalse
otherwise. Check this before using the store.- Returns:
-
getAssetStore
public AssetStore getAssetStore()
Returns the configuredAssetStore
for this environment ornull
if 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()
AClient
object 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)
-
-