Package org.eclipse.jetty.client.util
Class BasicAuthentication
- java.lang.Object
- 
- org.eclipse.jetty.client.util.AbstractAuthentication
- 
- org.eclipse.jetty.client.util.BasicAuthentication
 
 
- 
- All Implemented Interfaces:
- Authentication
 
 public class BasicAuthentication extends AbstractAuthentication Implementation of the HTTP "Basic" authentication defined in RFC 2617.Applications should create objects of this class and add them to the AuthenticationStoreretrieved from theHttpClientviaHttpClient.getAuthenticationStore().
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classBasicAuthentication.BasicResultBasic authentication result.- 
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.api.AuthenticationAuthentication.HeaderInfo, Authentication.Result
 
- 
 - 
Field Summary- 
Fields inherited from interface org.eclipse.jetty.client.api.AuthenticationANY_REALM
 
- 
 - 
Constructor SummaryConstructors Constructor Description BasicAuthentication(java.net.URI uri, java.lang.String realm, java.lang.String user, java.lang.String password)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Authentication.Resultauthenticate(Request request, ContentResponse response, Authentication.HeaderInfo headerInfo, Attributes context)Executes the authentication mechanism for the given request, returning aAuthentication.Resultthat can be used to actually authenticate the request viaAuthentication.Result.apply(Request).java.lang.StringgetType()- 
Methods inherited from class org.eclipse.jetty.client.util.AbstractAuthenticationgetRealm, getURI, matches, matchesURI
 
- 
 
- 
- 
- 
Constructor Detail- 
BasicAuthenticationpublic BasicAuthentication(java.net.URI uri, java.lang.String realm, java.lang.String user, java.lang.String password)- Parameters:
- uri- the URI to match for the authentication
- realm- the realm to match for the authentication
- user- the user that wants to authenticate
- password- the password of the user
 
 
- 
 - 
Method Detail- 
getTypepublic java.lang.String getType() - Specified by:
- getTypein class- AbstractAuthentication
 
 - 
authenticatepublic Authentication.Result authenticate(Request request, ContentResponse response, Authentication.HeaderInfo headerInfo, Attributes context) Description copied from interface:AuthenticationExecutes the authentication mechanism for the given request, returning aAuthentication.Resultthat can be used to actually authenticate the request viaAuthentication.Result.apply(Request).If a request for "/secure"returns aAuthentication.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.- Parameters:
- request- the request to execute the authentication mechanism for
- response- the 401 response obtained in the previous attempt to request the protected resource
- headerInfo- 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 exchanges
- Returns:
- the authentication result, or null if the authentication could not be performed
 
 
- 
 
-