API java : Configuration


javax.security.auth.login
Class Configuration

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

public abstract class Configuration
extends Object

This is an abstract class for representing the configuration of LoginModules under an application. The Configuration specifies which LoginModules should be used for a particular application, and in what order the LoginModules should be invoked. This abstract class needs to be subclassed to provide an implementation which reads and loads the actual Configuration.

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.

  1. ModuleClass Flag ModuleOptions;
  2. ModuleClass Flag ModuleOptions;
  3. ModuleClass Flag ModuleOptions;
  4. };
  5. ModuleClass Flag ModuleOptions;
  6. ModuleClass Flag ModuleOptions;
  7. };
  8. other {
  9. ModuleClass Flag ModuleOptions;
  10. ModuleClass Flag ModuleOptions;
  11. };

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. 1) Required - The LoginModule is required to succeed.
  2. If it succeeds or fails, authentication still continues
  3. to proceed down the LoginModule list.
  4.  
  5. 2) Requisite - The LoginModule is required to succeed.
  6. If it succeeds, authentication continues down the
  7. LoginModule list. If it fails,
  8. control immediately returns to the application
  9. (authentication does not proceed down the
  10. LoginModule list).
  11.  
  12. 3) Sufficient - The LoginModule is not required to
  13. succeed. If it does succeed, control immediately
  14. returns to the application (authentication does not
  15. proceed down the LoginModule list).
  16. If it fails, authentication continues down the
  17.  
  18. 4) Optional - The LoginModule is not required to
  19. succeed. If it succeeds or fails,
  20. authentication still continues to proceed down the

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:

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

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.

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 implementation class. The Java security properties file is located in the file named <JAVA_HOME>/lib/security/java.security, where <JAVA_HOME> refers to the directory where the JDK was installed.

See Also:
LoginContext

Constructor Summary
protected Configuration()
          Sole constructor.
 
Method Summary
abstract  AppConfigurationEntry[] getAppConfigurationEntry(String name)
          Retrieve the AppConfigurationEntries for the specified name from this Configuration.
static Configuration getConfiguration()
          Get the Login Configuration.
abstract  void refresh()
          Refresh and reload the Configuration.
static void setConfiguration(Configuration configuration)
          Set the Login Configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

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

Method Detail

getConfiguration

public static Configuration getConfiguration()
Get the Login Configuration.

Returns:
the login Configuration. If a Configuration object was set via the Configuration.setConfiguration method, then that object is returned. Otherwise, a default Configuration object is returned.
Throws:
SecurityException - if the caller does not have permission to retrieve the Configuration.
See Also:
setConfiguration(javax.security.auth.login.Configuration)

setConfiguration

public static void setConfiguration(Configuration configuration)
Set the Login Configuration.

Parameters:
configuration - the new Configuration
Throws:
SecurityException - if the current thread does not have Permission to set the Configuration.
See Also:
getConfiguration()

getAppConfigurationEntry

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

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

refresh

public abstract void refresh()
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.

Throws:
SecurityException - if the caller does not have permission to refresh its Configuration.

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

8 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-3077
Document créé le 01/09/06 01:30, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/security/auth/login/Configuration.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,66 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Ce qui vaut la peine d'être fait vaut la peine d'être bien fait.

Nicolas Poussin
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 03:25, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)