モジュール jdk.security.auth

クラスJndiLoginModule

java.lang.Object
com.sun.security.auth.module.JndiLoginModule
すべての実装されたインタフェース:
LoginModule

public class JndiLoginModule extends Object implements LoginModule
ユーザー名とパスワードの入力を要求し、JNDI下で構成されたディレクトリ・サービスに格納されているパスワードで、入力されたパスワードを確認します。

このLoginModuleは、仕様に準拠したJNDIサービス・プロバイダと相互運用します。 特定のJNDIサービス・プロバイダを使用するためにこのLoginModuleを構成するには、このLoginModuleのログインConfigurationで2つのオプションを指定する必要があります。

      user.provider.url=name_service_url
      group.provider.url=name_service_url
 
name_service_urlには、このLoginModuleが関連するユーザーとグループの情報にアクセスするための、ディレクトリ・サービスとパスを指定します。 このLoginModuleでは関連ユーザー情報の検索に単一レベル検索を実行するだけなので、ディレクトリ・サービスでユーザーとグループの情報が格納されているディレクトリの1レベル上をURLで指している必要があります。 たとえば、NISサーバーに接続するようにこのLoginModuleを構成するには、次のURLを指定する必要があります。
    user.provider.url="nis://NISServerHostName/NISDomain/user"
    group.provider.url="nis://NISServerHostName/NISDomain/system/group"
 
NISServerHostNameはNISサーバーのサーバー・ホスト名(nis.sun.comなど)、NISDomainはそのNISサーバーのドメイン(jaas.sun.comなど)を指定します。 LDAPサーバーにアクセスするには、次のURLを指定します。
    user.provider.url="ldap://LDAPServerHostName/LDAPName"
    group.provider.url="ldap://LDAPServerHostName/LDAPName"
 
LDAPServerHostNameはLDAPサーバーのホスト名でポート番号を含むことがあり(ldap.sun.com:389など)、LDAPNameはLDAPディレクトリでのエントリ名(ユーザー情報はou=People,o=Sun,c=US、グループ情報はou=Groups,o=Sun,c=USなど)になります。

ディレクトリ・サービスに格納されるユーザー情報の形式はRFC 2307で規定されています。 具体的には、このLoginModuleは、ユーザーのuid属性を使用してディレクトリ・サービスでユーザーのエントリを検索します(ここでuid=username)。 検索が成功すると、このLoginModuleによってuserPassword属性を使用して取得したエントリから、ユーザーの暗号化されたパスワードが入手されます。 このLoginModuleでは、パスワードがバイト配列で格納されていると想定されています。パスワードはStringに変換すると次の形式になります。

      "{crypt}encrypted_password"
 
LDAPディレクトリ・サーバーは、userPassword属性の読取りアクセスが許可されるように構成する必要があります。 ユーザーが有効なユーザー名とパスワードを入力すると、このLoginModuleではUnixPrincipalUnixNumericUserPrincipal、および関連するUnixNumericGroupPrincipalsをSubjectと関連付けます。

このLoginModuleは、次のConfigurationオプションも認識します。

    debug          if, true, debug messages are output to System.out.

    useFirstPass   if, true, this LoginModule retrieves the
                   username and password from the module's shared state,
                   using "javax.security.auth.login.name" and
                   "javax.security.auth.login.password" as the respective
                   keys.  The retrieved values are used for authentication.
                   If authentication fails, no attempt for a retry is made,
                   and the failure is reported back to the calling
                   application.

    tryFirstPass   if, true, this LoginModule retrieves the
                   the username and password from the module's shared state,
                   using "javax.security.auth.login.name" and
                   "javax.security.auth.login.password" as the respective
                   keys.  The retrieved values are used for authentication.
                   If authentication fails, the module uses the
                   CallbackHandler to retrieve a new username and password,
                   and another attempt to authenticate is made.
                   If the authentication fails, the failure is reported
                   back to the calling application.

    storePass      if, true, this LoginModule stores the username and password
                   obtained from the CallbackHandler in the module's
                   shared state, using "javax.security.auth.login.name" and
                   "javax.security.auth.login.password" as the respective
                   keys.  This is not performed if existing values already
                   exist for the username and password in the shared state,
                   or if authentication fails.

    clearPass     if, true, this LoginModule clears the
                  username and password stored in the module's shared state
                  after both phases of authentication (login and commit)
                  have completed.