public interface Authentication
Authentication
represents a mechanism to authenticate requests for protected resources.
Authentication
s are added to an AuthenticationStore
, which is then
queried
to find the right
Authentication
mechanism to use based on its type, URI and realm, as returned by
WWW-Authenticate
response headers.
If an Authentication
mechanism is found, it is then
executed
for the given request,
returning an Authentication.Result
, which is then stored in the AuthenticationStore
so that subsequent requests can be preemptively authenticated.
Modifier and Type | Interface and Description |
---|---|
static class |
Authentication.HeaderInfo
Structure holding information about the
WWW-Authenticate (or Proxy-Authenticate ) header. |
static interface |
Authentication.Result
Result holds the information needed to authenticate a Request via Authentication.Result.apply(Request) . |
Modifier and Type | Method and Description |
---|---|
Authentication.Result |
authenticate(Request request,
ContentResponse response,
Authentication.HeaderInfo headerInfo,
Attributes context)
Executes the authentication mechanism for the given request, returning a
Result that can be
used to actually authenticate the request via Result#apply(Request) . |
boolean |
matches(String type,
URI uri,
String realm)
Matches
Authentication s based on the given parameters |
boolean matches(String type, URI uri, String realm)
Authentication
s based on the given parameterstype
- the Authentication
type such as "Basic" or "Digest"uri
- the request URIrealm
- the authentication realm as provided in the WWW-Authenticate
response headerAuthentication.Result authenticate(Request request, ContentResponse response, Authentication.HeaderInfo headerInfo, Attributes context)
Result
that can be
used to actually authenticate the request via Result#apply(Request)
.
If a request for "/secure"
returns a Result
, then the result may be used for other
requests such as "/secure/foo"
or "/secure/bar"
, unless those resources are protected
by other realms.
request
- the request to execute the authentication mechanism forresponse
- the 401 response obtained in the previous attempt to request the protected resourceheaderInfo
- the WWW-Authenticate
(or Proxy-Authenticate
) header chosen for this
authentication (among the many that the response may contain)context
- the conversation context in case the authentication needs multiple exchanges
to be completed and information needs to be stored across exchangesCopyright © 1995-2015 Webtide. All Rights Reserved.