Class 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

    • 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()
        Returns true if a store has been configured for this environment and false otherwise. Check this before using the store.
        Returns:
      • 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:
      • 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 the setCallback(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 the getPublicKey()
        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()
        A Client 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 the setCertLifetime(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)