Spec-Zone .ru
спецификации, руководства, описания, API
|
|
Java HTTP Server DRAFT ea-b118 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 of checkCredentials(String,String)
which is called to verify each incoming request.
Modifier and Type | Class and Description |
---|
Nested classes/interfaces inherited from class com.sun.net.httpserver.Authenticator |
---|
Authenticator.Failure, Authenticator.Result, Authenticator.Retry, Authenticator.Success |
Modifier and Type | Field and Description |
---|---|
protected String |
realm
|
Constructor and Description |
---|
BasicAuthenticator(String realm)
Creates a BasicAuthenticator for the given HTTP realm |
Modifier and Type | Method and Description |
---|---|
Authenticator.Result |
authenticate(HttpExchange t)
called to authenticate each incoming request. |
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. |
String |
getRealm()
returns the realm this BasicAuthenticator was created with |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String realm
Constructor Detail |
---|
public BasicAuthenticator(String realm)
realm
- The HTTP Basic authentication realmNullPointerException
- if the realm is an empty stringMethod Detail |
---|
public String getRealm()
public Authenticator.Result authenticate(HttpExchange t)
Authenticator
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.
authenticate
in class Authenticator
public abstract boolean checkCredentials(String username, String password)
username
- the username from the requestpassword
- the password from the requesttrue
if the credentials are valid,
false
otherwise.
|
Java HTTP Server DRAFT ea-b118 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2005, 2010, Oracle Corporation. All rights reserved.