|
Java プラットフォーム 1.2 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object | +--java.net.Authenticator
Authenticator クラスは、ネットワーク接続に必要な認証を取得するためのオブジェクトを表します。通常は、ユーザに情報の入力を求めることにより、認証を行います。
アプリケーションでこのクラスを使うには、サブクラスを作成し、SetDefault() を使ってシステムにサブクラスのインスタンスを登録します。認証が要求されると、システムはサブクラスのメソッド (getPasswordAuthentication など) を呼び出します。サブクラスのメソッドは、多数の継承されたメソッド (getRequesting で始まるメソッド) を使って、要求された認証について照会を行うことができます。そのあとで、ユーザに表示する適切なメッセージを形成できます。
認証を要求するメソッドはすべて、失敗に終わるデフォルト実装を持っています。
java.net.Authenticator.setDefault(java.net.ConnectionAuthenticator)
,
java.net.getPasswordAuthentication()
コンストラクタの概要 | |
Authenticator()
|
メソッドの概要 | |
protected PasswordAuthentication |
getPasswordAuthentication()
パスワード認証が必要な場合に呼び出されます。 |
protected int |
getRequestingPort()
|
protected String |
getRequestingPrompt()
|
protected String |
getRequestingProtocol()
接続を要求しているプロトコルを返します。 |
protected String |
getRequestingScheme()
|
protected InetAddress |
getRequestingSite()
|
static PasswordAuthentication |
requestPasswordAuthentication(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)
null
であり、オーセンティケータが設定されていない場合は、何もしないでメソッドがそのまま復帰します。
セキュリティマネージャが存在する場合、まずセキュリティマネージャの checkPermission
メソッドが、アクセス権 NetPermission("setDefaultAuthenticator")
を指定して呼び出されます。この結果、java.lang.SecurityException になることがあります。
通常、このメソッドは、システムの起動時に 1 回だけ呼び出されます。
a
- オーセンティケータ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
- 接続を要求しているプロトコル (@see java.net.Authenticator.getProtocol())prompt
- ユーザに表示されるプロンプト文字列scheme
- 認証方式checkPermission
メソッドが、パスワード認証要求を許可しない場合SecurityManager.checkPermission(java.security.Permission)
,
NetPermission
protected final InetAddress getRequestingSite()
protected final int getRequestingPort()
protected final String getRequestingProtocol()
java.net.URL.getProtocol()
protected final String getRequestingPrompt()
protected final String getRequestingScheme()
protected PasswordAuthentication getPasswordAuthentication()
|
Java プラットフォーム 1.2 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |