*** This class provides Binary Compatibility only, not Source Compatibility ***

Class Environment

java.lang.Object
com.sas.services.deployment.Environment
All Implemented Interfaces:
com.sas.services.connection.ConnectionResources, Serializable

@SASScope("ALL") @BinaryCompatibilityOnly public class Environment extends Object implements ConnectionResources, Serializable
An encapsulation of runtime resources provided by the container. For example, resources provided to J2EE connectors through javax.resource.spi.BootstrapContext might be encapsulated here. Applications can also use objects of this class to provide a simulated JAAS configuration to Foundation Services so that Foundation Services can be deployed in an environment without a "real" JAAS configuration.
Since:
9.2
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an Environment object.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<AppConfigurationEntry>
    getAppConfigurationEntry(String appConfigurationEntryName)
    Return the JAAS application configuration entry for Foundation Services.
    void
    setAppConfigurationEntry(AppConfigurationEntry[] appConfigurationEntry)
    Set the simulated JAAS application configuration entry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Environment

      public Environment()
      Create an Environment object.
  • Method Details

    • setAppConfigurationEntry

      public void setAppConfigurationEntry(AppConfigurationEntry[] appConfigurationEntry)
      Set the simulated JAAS application configuration entry. This method allows an application to change the JAAS configuration used by Foundation Services at runtime without calling javax.security.auth.login.Configuration.setConfiguration(). That method sets the new JAAS configuration globally and may affect the operation of other parts of the system that depend on JAAS.

      Applications may use this method to change the JAAS configuration for a Foundation Services deployment that has already been deployed. The new JAAS configuration will take effect immediately. However, the behavior of any existing UserContext objects at the time this method is called is undefined. Therefore, it is a best practice to call this method only before deploying Foundation Services or after destroying all UserContext objects.

      The following code provides a sample that shows how one might define an AppConfigurationEntry for an OMILoginModule.

           import java.util.HashMap;
           import java.util.Map;
           import javax.security.auth.login.AppConfigurationEntry;
           import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
      
           import com.sas.services.security.login.LoginPropertyConstants;
           import com.sas.services.security.login.OMILoginModule;
      
           Map optionsMap = new HashMap(5);
           optionsMap.put(
              LoginPropertyConstants.PROPERTYNAME_HOST,
              "xxx.yyy.com");
           optionsMap.put(
              LoginPropertyConstants.PROPERTYNAME_PORT,
              "8561");
           optionsMap.put(
              "repository",
              "Foundation");
           optionsMap.put(
              LoginPropertyConstants.PROPERTYNAME_DOMAIN,
              "DefaultAuth");
           optionsMap.put(
              LoginPropertyConstants.PROPERTYNAME_DEBUG,
              LoginPropertyConstants.PROPERTYVALUE_FALSE);
      
           AppConfigurationEntry[] appConfigurationEntries = new AppConfigurationEntry[]  {
             new AppConfigurationEntry(
               OMILoginModule.class.getName(), 
               LoginModuleControlFlag.OPTIONAL, 
               optionsMap)
           };       
       

      Parameters:
      appConfigurationEntry - the simulated JAAS application configuration entry or null if there are no entries.
    • getAppConfigurationEntry

      public List<AppConfigurationEntry> getAppConfigurationEntry(String appConfigurationEntryName)
      Return the JAAS application configuration entry for Foundation Services. If an entry has been provided by calling setAppConfigurationEntry(), that entry will be returned. Otherwise, this method will look up the entry in the JAAS configuration and return it. If there is no entry with the given name, this method will return null.

      The returned object is an unmodifiable list whose elements are all instances of javax.security.auth.login.AppConfigurationEntry.

      Parameters:
      appConfigurationEntryName - Name of the desired application configuration entry.
      Returns:
      the JAAS application configuration entry for Foundation Services