- java.lang.Object
- 
- com.sun.net.httpserver.Authenticator
- 
- com.sun.net.httpserver.BasicAuthenticator
 
 
- 
 public abstract class BasicAuthenticator extends Authenticator BasicAuthenticator provides an implementation of HTTP Basic authentication. It is an abstract class and must be extended to provide an implementation ofcheckCredentials(String,String)which is called to verify each incoming request.
- 
- 
Nested Class Summary- 
Nested classes/interfaces declared in class com.sun.net.httpserver.AuthenticatorAuthenticator.Failure, Authenticator.Result, Authenticator.Retry, Authenticator.Success
 
- 
 - 
Constructor SummaryConstructors Constructor Description BasicAuthenticator(String realm)Creates a BasicAuthenticator for the given HTTP realm
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleancheckCredentials(String username, String password)called for each incoming request to verify the given name and password in the context of this Authenticator's realm.StringgetRealm()returns the realm this BasicAuthenticator was created with- 
Methods declared in class com.sun.net.httpserver.Authenticatorauthenticate
 
- 
 
- 
- 
- 
Field Detail- 
realmprotected String realm 
 
- 
 - 
Constructor Detail- 
BasicAuthenticatorpublic BasicAuthenticator(String realm) Creates a BasicAuthenticator for the given HTTP realm- Parameters:
- realm- The HTTP Basic authentication realm
- Throws:
- NullPointerException- if the realm is an empty string
 
 
- 
 - 
Method Detail- 
getRealmpublic String getRealm() returns the realm this BasicAuthenticator was created with- Returns:
- the authenticator's realm string.
 
 - 
checkCredentialspublic abstract boolean checkCredentials(String username, String password) called for each incoming request to verify the given name and password in the context of this Authenticator's realm. Any caching of credentials must be done by the implementation of this method- Parameters:
- username- the username from the request
- password- the password from the request
- Returns:
- trueif the credentials are valid,- falseotherwise.
 
 
- 
 
-