|
Java HTTP Server | ||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object com.sun.net.httpserver.Authenticator com.sun.net.httpserver.BasicAuthenticator
public abstract class BasicAuthenticator
BasicAuthenticator は、HTTP 基本認証の実装を提供します。これは abstract クラスであり、各着信要求を検証するために呼び出される checkCredentials(String,String)
の実装を提供するには拡張する必要があります。
入れ子のクラスの概要 |
---|
クラス com.sun.net.httpserver.Authenticator から継承された入れ子のクラス/インタフェース |
---|
Authenticator.Failure, Authenticator.Result, Authenticator.Retry, Authenticator.Success |
フィールドの概要 | |
---|---|
protected String |
realm
|
コンストラクタの概要 | |
---|---|
BasicAuthenticator(String realm)
指定された HTTP 領域のための BasicAuthenticator を作成します。 |
メソッドの概要 | |
---|---|
Authenticator.Result |
authenticate(HttpExchange t)
各着信要求を認証するために呼び出されます。 |
abstract boolean |
checkCredentials(String username,
String password)
指定された名前とパスワードをこの Authenticator の領域のコンテキストで検証するために、着信要求ごとに呼び出されます。 |
String |
getRealm()
この BasicAuthenticator が作成された領域を返します。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
protected String realm
コンストラクタの詳細 |
---|
public BasicAuthenticator(String realm)
realm
- HTTP 基本認証の領域
NullPointerException
- 領域が空の文字列である場合メソッドの詳細 |
---|
public String getRealm()
public Authenticator.Result authenticate(HttpExchange t)
Authenticator
の記述:Failure は、認証は完了したが、無効な資格のために失敗したことを意味します。
Sucess は、認証が正常に行われ、Sucess.getPrincipal() を呼び出すことでユーザーを表す Principal オブジェクトを取得できることを意味します。
Retry は、別の HTTP 交換が必要であることを意味します。クライアントに送り返す必要がある応答ヘッダーは、指定された HttpExchange に設定されます。返される応答コードを Retry オブジェクトに提供する必要があります。Retry は複数回発生することがあります。
Authenticator
内の authenticate
public abstract boolean checkCredentials(String username, String password)
username
- 要求からのユーザー名password
- 要求からのパスワード
true
、そうでない場合は false
|
Java HTTP Server | ||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |