java.lang.Object | ||
↳ | com.sun.net.httpserver.Authenticator | |
↳ | com.sun.net.httpserver.BasicAuthenticator |
BasicAuthenticator provides an implementation of HTTP Basic
authentication. It is an abstract class and must be extended
to provide an implementation of checkCredentials(String, String)
which is called to verify each incoming request.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
realm |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a BasicAuthenticator for the given HTTP realm
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
called to authenticate each incoming request.
| |||||||||||
called for each incoming request to verify the
given name and password in the context of this
Authenticator's realm.
| |||||||||||
returns the realm this BasicAuthenticator was created with
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Creates a BasicAuthenticator for the given HTTP realm
realm | The HTTP Basic authentication realm |
---|
NullPointerException | if the realm is an empty string |
---|
called to authenticate each incoming request. The implementation must return a Failure, Success or Retry object as appropriate :-
Failure means the authentication has completed, but has failed due to invalid credentials.
Sucess means that the authentication has succeeded, and a Principal object representing the user can be retrieved by calling Sucess.getPrincipal() .
Retry means that another HTTP exchange is required. Any response headers needing to be sent back to the client are set in the given HttpExchange. The response code to be returned must be provided in the Retry object. Retry may occur multiple times.
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
username | the username from the request |
---|---|
password | the password from the request |
true
if the credentials are valid,
false
otherwise.
returns the realm this BasicAuthenticator was created with