|
Foundation 1.1.2 | |||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object java.net.Authenticator
public abstract class Authenticator
Authenticator クラスは、ネットワーク接続に必要な認証を取得するためのオブジェクトを表します。通常は、ユーザーに情報の入力を求めることにより、認証を行います。
アプリケーションでこのクラスを使うには、サブクラスを作成し、setDefault() を使ってそのサブクラスのインスタンスをシステムに登録します。認証が要求されると、システムはサブクラスのメソッド (getPasswordAuthentication など) を呼び出します。サブクラスのメソッドは、多数の継承されたメソッド (getRequestingXXX()) を使って、要求されている認証について照会を行い、ユーザーに対して適切なメッセージを構築します。
認証を要求するメソッドはすべて、失敗に終わるデフォルト実装を持っています。
setDefault(java.net.Authenticator)
,
getPasswordAuthentication()
コンストラクタの概要 | |
---|---|
Authenticator()
|
メソッドの概要 | |
---|---|
protected PasswordAuthentication |
getPasswordAuthentication()
パスワード認証が必要な場合に呼び出されます。 |
protected String |
getRequestingHost()
認証を要求しているサイトまたはプロキシの hostname を取得します。 |
protected int |
getRequestingPort()
要求された接続に使うポート番号を取得します。 |
protected String |
getRequestingPrompt()
要求者が入力したプロンプト文字列を取得します。 |
protected String |
getRequestingProtocol()
接続を要求しているプロトコルを返します。 |
protected String |
getRequestingScheme()
要求者が使用している方式 (たとえば、HTTP ファイアウォールの場合は HTTP 方式) |
protected InetAddress |
getRequestingSite()
許可を要求しているサイトの InetAddress を取得します。 |
static PasswordAuthentication |
requestPasswordAuthentication(InetAddress addr,
int port,
String protocol,
String prompt,
String scheme)
システムに登録されているオーセンティケータに、パスワードを要求します。 |
static PasswordAuthentication |
requestPasswordAuthentication(String host,
InetAddress addr,
int port,
String protocol,
String prompt,
String scheme)
システムに登録されているオーセンティケータに、パスワードを要求します。 |
static void |
setDefault(Authenticator a)
オーセンティケータを設定します。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
コンストラクタの詳細 |
---|
public Authenticator()
メソッドの詳細 |
---|
public static void setDefault(Authenticator a)
セキュリティーマネージャーが存在する場合、最初にセキュリティーマネージャーの checkPermission
メソッドが、アクセス権 NetPermission("setDefaultAuthenticator")
を指定して呼び出されます。この結果、java.lang.SecurityException になることがあります。
a
- 設定されるオーセンティケータ。a が null
の場合、以前に設定されたオーセンティケータは削除される
SecurityException
- セキュリティーマネージャーが存在し、その checkPermission
メソッドがデフォルトオーセンティケータの設定を許可しない場合SecurityManager.checkPermission(java.security.Permission)
,
NetPermission
public static PasswordAuthentication requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme)
セキュリティーマネージャーが存在する場合、最初にセキュリティーマネージャーの checkPermission
メソッドが、アクセス権 NetPermission("requestPasswordAuthentication")
を指定して呼び出されます。この結果、java.lang.SecurityException になることがあります。
addr
- 承認を要求しているサイトの InetAddress。InetAddress が不明の場合は nullport
- 要求された接続に使うポート番号protocol
- 接続を要求しているプロトコル (getRequestingProtocol()
)prompt
- ユーザーに表示されるプロンプト文字列scheme
- 認証方式
SecurityException
- セキュリティーマネージャーが存在し、その checkPermission
メソッドがパスワード認証要求を許可しない場合SecurityManager.checkPermission(java.security.Permission)
,
NetPermission
public static PasswordAuthentication requestPasswordAuthentication(String host, InetAddress addr, int port, String protocol, String prompt, String scheme)
セキュリティーマネージャーが存在する場合、最初にセキュリティーマネージャーの checkPermission
メソッドが、アクセス権 NetPermission("requestPasswordAuthentication")
を指定して呼び出されます。この結果、java.lang.SecurityException になることがあります。
host
- 認証を要求しているサイトのホスト名addr
- 認証を要求しているサイトの InetAddress。InetAddress が不明の場合は nullport
- 要求された接続に使うポート番号protocol
- 接続を要求しているプロトコル (getRequestingProtocol()
)prompt
- 認証領域を識別する、ユーザーに表示されるプロンプト文字列scheme
- 認証方式
SecurityException
- セキュリティーマネージャーが存在し、その checkPermission
メソッドがパスワード認証要求を許可しない場合SecurityManager.checkPermission(java.security.Permission)
,
NetPermission
protected final String getRequestingHost()
hostname
を取得します。hostname が使用できない場合は null
が返されます。
protected final InetAddress getRequestingSite()
InetAddress
を取得します。InetAddress が使用できない場合は null
が返されます。
protected final int getRequestingPort()
int
protected final String getRequestingProtocol()
URL.getProtocol()
protected final String getRequestingPrompt()
protected final String getRequestingScheme()
protected PasswordAuthentication getPasswordAuthentication()
|
Foundation 1.1.2 | |||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。