Java Doc for Configuration.java in  » 6.0-JDK-Core » security » javax » security » auth » login » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » security » javax.security.auth.login 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.security.auth.login.Configuration

Configuration
abstract public class Configuration (Code)
A Configuration object is responsible for specifying which LoginModules should be used for a particular application, and in what order the LoginModules should be invoked.

A login configuration contains the following information. Note that this example only represents the default syntax for the Configuration. Subclass implementations of this class may implement alternative syntaxes and may retrieve the Configuration from any source such as files, databases, or servers.

 Name {
 ModuleClass  Flag    ModuleOptions;
 ModuleClass  Flag    ModuleOptions;
 ModuleClass  Flag    ModuleOptions;
 };
 Name {
 ModuleClass  Flag    ModuleOptions;
 ModuleClass  Flag    ModuleOptions;
 };
 other {
 ModuleClass  Flag    ModuleOptions;
 ModuleClass  Flag    ModuleOptions;
 };
 

Each entry in the Configuration is indexed via an application name, Name, and contains a list of LoginModules configured for that application. Each LoginModule is specified via its fully qualified class name. Authentication proceeds down the module list in the exact order specified. If an application does not have specific entry, it defaults to the specific entry for "other".

The Flag value controls the overall behavior as authentication proceeds down the stack. The following represents a description of the valid values for Flag and their respective semantics:

 1) Required     - The LoginModule is required to succeed.
 If it succeeds or fails, authentication still continues
 to proceed down the LoginModule list.
 2) Requisite    - The LoginModule is required to succeed.
 If it succeeds, authentication continues down the
 LoginModule list.  If it fails,
 control immediately returns to the application
 (authentication does not proceed down the
 LoginModule list).
 3) Sufficient   - The LoginModule is not required to
 succeed.  If it does succeed, control immediately
 returns to the application (authentication does not
 proceed down the LoginModule list).
 If it fails, authentication continues down the
 LoginModule list.
 4) Optional     - The LoginModule is not required to
 succeed.  If it succeeds or fails,
 authentication still continues to proceed down the
 LoginModule list.
 

The overall authentication succeeds only if all Required and Requisite LoginModules succeed. If a Sufficient LoginModule is configured and succeeds, then only the Required and Requisite LoginModules prior to that Sufficient LoginModule need to have succeeded for the overall authentication to succeed. If no Required or Requisite LoginModules are configured for an application, then at least one Sufficient or Optional LoginModule must succeed.

ModuleOptions is a space separated list of LoginModule-specific values which are passed directly to the underlying LoginModules. Options are defined by the LoginModule itself, and control the behavior within it. For example, a LoginModule may define options to support debugging/testing capabilities. The correct way to specify options in the Configuration is by using the following key-value pairing: debug="true". The key and value should be separated by an 'equals' symbol, and the value should be surrounded by double quotes. If a String in the form, ${system.property}, occurs in the value, it will be expanded to the value of the system property. Note that there is no limit to the number of options a LoginModule may define.

The following represents an example Configuration entry based on the syntax above:

 Login {
 com.sun.security.auth.module.UnixLoginModule required;
 com.sun.security.auth.module.Krb5LoginModule optional
 useTicketCache="true"
 ticketCache="${user.home}${/}tickets";
 };
 

This Configuration specifies that an application named, "Login", requires users to first authenticate to the com.sun.security.auth.module.UnixLoginModule, which is required to succeed. Even if the UnixLoginModule authentication fails, the com.sun.security.auth.module.Krb5LoginModule still gets invoked. This helps hide the source of failure. Since the Krb5LoginModule is Optional, the overall authentication succeeds only if the UnixLoginModule (Required) succeeds.

Also note that the LoginModule-specific options, useTicketCache="true" and ticketCache=${user.home}${/}tickets", are passed to the Krb5LoginModule. These options instruct the Krb5LoginModule to use the ticket cache at the specified location. The system properties, user.home and / (file.separator), are expanded to their respective values.

There is only one Configuration object installed in the runtime at any given time. A Configuration object can be installed by calling the setConfiguration method. The installed Configuration object can be obtained by calling the getConfiguration method.

If no Configuration object has been installed in the runtime, a call to getConfiguration installs an instance of the default Configuration implementation (a default subclass implementation of this abstract class). The default Configuration implementation can be changed by setting the value of the "login.configuration.provider" security property (in the Java security properties file) to the fully qualified name of the desired Configuration subclass implementation. The Java security properties file is located in the file named <JAVA_HOME>/lib/security/java.security. <JAVA_HOME> refers to the value of the java.home system property, and specifies the directory where the JRE is installed.

Application code can directly subclass Configuration to provide a custom implementation. In addition, an instance of a Configuration object can be constructed by invoking one of the getInstance factory methods with a standard type. The default policy type is "JavaLoginConfig". See Appendix A in the Java Cryptography Architecture API Specification & Reference for a list of standard Configuration types.
version:
   1.70, 05/05/07
See Also:   javax.security.auth.login.LoginContext


Inner Class :public static interface Parameters


Constructor Summary
protected  Configuration()
     Sole constructor.

Method Summary
abstract public  AppConfigurationEntry[]getAppConfigurationEntry(String name)
     Retrieve the AppConfigurationEntries for the specified name from this Configuration.


Parameters:
  name - the name used to index the Configuration.

public static synchronized  ConfigurationgetConfiguration()
     Get the installed login Configuration.

the login Configuration.

public static  ConfigurationgetInstance(String type, Configuration.Parameters params)
     Returns a Configuration object of the specified type.

This method traverses the list of registered security providers, starting with the most preferred Provider. A new Configuration object encapsulating the ConfigurationSpi implementation from the first Provider that supports the specified type is returned.

Note that the list of registered providers may be retrieved via the Security.getProviders Security.getProviders() method.
Parameters:
  type - the specified Configuration type.

public static  ConfigurationgetInstance(String type, Configuration.Parameters params, String provider)
     Returns a Configuration object of the specified type.

A new Configuration object encapsulating the ConfigurationSpi implementation from the specified provider is returned.

public static  ConfigurationgetInstance(String type, Configuration.Parameters params, Provider provider)
     Returns a Configuration object of the specified type.

A new Configuration object encapsulating the ConfigurationSpi implementation from the specified Provider object is returned.

public  Configuration.ParametersgetParameters()
     Return Configuration parameters.
public  ProvidergetProvider()
     Return the Provider of this Configuration.
public  StringgetType()
     Return the type of this Configuration.
public  voidrefresh()
     Refresh and reload the Configuration.
public static  voidsetConfiguration(Configuration configuration)
     Set the login Configuration.


Constructor Detail
Configuration
protected Configuration()(Code)
Sole constructor. (For invocation by subclass constructors, typically implicit.)




Method Detail
getAppConfigurationEntry
abstract public AppConfigurationEntry[] getAppConfigurationEntry(String name)(Code)
Retrieve the AppConfigurationEntries for the specified name from this Configuration.


Parameters:
  name - the name used to index the Configuration. an array of AppConfigurationEntries for the specified namefrom this Configuration, or null if there are no entriesfor the specified name




getConfiguration
public static synchronized Configuration getConfiguration()(Code)
Get the installed login Configuration.

the login Configuration. If a Configuration object was setvia the Configuration.setConfiguration method,then that object is returned. Otherwise, a defaultConfiguration object is returned.
exception:
  SecurityException - if the caller does not have permissionto retrieve the Configuration.
See Also:   Configuration.setConfiguration




getInstance
public static Configuration getInstance(String type, Configuration.Parameters params) throws NoSuchAlgorithmException(Code)
Returns a Configuration object of the specified type.

This method traverses the list of registered security providers, starting with the most preferred Provider. A new Configuration object encapsulating the ConfigurationSpi implementation from the first Provider that supports the specified type is returned.

Note that the list of registered providers may be retrieved via the Security.getProviders Security.getProviders() method.
Parameters:
  type - the specified Configuration type. See Appendix A in theJava Cryptography Architecture API Specification & Reference for a list of standard Configuration types.
Parameters:
  params - parameters for the Configuration, which may be null. the new Configuration object.
exception:
  SecurityException - if the caller does not have permissionto get a Configuration instance for the specified type.
exception:
  NullPointerException - if the specified type is null.
exception:
  IllegalArgumentException - if the specified parametersare not understood by the ConfigurationSpi implementationfrom the selected Provider.
exception:
  NoSuchAlgorithmException - if no Provider supports aConfigurationSpi implementation for the specified type.
See Also:   Provider
since:
   1.6




getInstance
public static Configuration getInstance(String type, Configuration.Parameters params, String provider) throws NoSuchProviderException, NoSuchAlgorithmException(Code)
Returns a Configuration object of the specified type.

A new Configuration object encapsulating the ConfigurationSpi implementation from the specified provider is returned. The specified provider must be registered in the provider list.

Note that the list of registered providers may be retrieved via the Security.getProviders Security.getProviders() method.
Parameters:
  type - the specified Configuration type. See Appendix A in theJava Cryptography Architecture API Specification & Reference for a list of standard Configuration types.
Parameters:
  params - parameters for the Configuration, which may be null.
Parameters:
  provider - the provider. the new Configuration object.
exception:
  SecurityException - if the caller does not have permissionto get a Configuration instance for the specified type.
exception:
  NullPointerException - if the specified type is null.
exception:
  IllegalArgumentException - if the specified provideris null or empty,or if the specified parameters are not understood bythe ConfigurationSpi implementation from the specified provider.
exception:
  NoSuchProviderException - if the specified provider is notregistered in the security provider list.
exception:
  NoSuchAlgorithmException - if the specified provider does notsupport a ConfigurationSpi implementation for the specifiedtype.
See Also:   Provider
since:
   1.6




getInstance
public static Configuration getInstance(String type, Configuration.Parameters params, Provider provider) throws NoSuchAlgorithmException(Code)
Returns a Configuration object of the specified type.

A new Configuration object encapsulating the ConfigurationSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.
Parameters:
  type - the specified Configuration type. See Appendix A in theJava Cryptography Architecture API Specification & Reference for a list of standard Configuration types.
Parameters:
  params - parameters for the Configuration, which may be null.
Parameters:
  provider - the Provider. the new Configuration object.
exception:
  SecurityException - if the caller does not have permissionto get a Configuration instance for the specified type.
exception:
  NullPointerException - if the specified type is null.
exception:
  IllegalArgumentException - if the specified Provider is null,or if the specified parameters are not understood bythe ConfigurationSpi implementation from the specified Provider.
exception:
  NoSuchAlgorithmException - if the specified Provider does notsupport a ConfigurationSpi implementation for the specifiedtype.
See Also:   Provider
since:
   1.6




getParameters
public Configuration.Parameters getParameters()(Code)
Return Configuration parameters.

This Configuration instance will only have parameters if it was obtained via a call to Configuration.getInstance. Otherwise this method returns null. Configuration parameters, or null.
since:
   1.6




getProvider
public Provider getProvider()(Code)
Return the Provider of this Configuration.

This Configuration instance will only have a Provider if it was obtained via a call to Configuration.getInstance. Otherwise this method returns null. the Provider of this Configuration, or null.
since:
   1.6




getType
public String getType()(Code)
Return the type of this Configuration.

This Configuration instance will only have a type if it was obtained via a call to Configuration.getInstance. Otherwise this method returns null. the type of this Configuration, or null.
since:
   1.6




refresh
public void refresh()(Code)
Refresh and reload the Configuration.

This method causes this Configuration object to refresh/reload its contents in an implementation-dependent manner. For example, if this Configuration object stores its entries in a file, calling refresh may cause the file to be re-read.

The default implementation of this method does nothing. This method should be overridden if a refresh operation is supported by the implementation.
exception:
  SecurityException - if the caller does not have permissionto refresh its Configuration.




setConfiguration
public static void setConfiguration(Configuration configuration)(Code)
Set the login Configuration.


Parameters:
  configuration - the new Configuration
exception:
  SecurityException - if the current thread does not havePermission to set the Configuration.
See Also:   Configuration.getConfiguration




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.