Package com.google.api.client.http
Class BasicAuthentication
java.lang.Object
com.google.api.client.http.BasicAuthentication
- All Implemented Interfaces:
HttpExecuteInterceptor
,HttpRequestInitializer
public final class BasicAuthentication
extends Object
implements HttpRequestInitializer, HttpExecuteInterceptor
Basic authentication HTTP request initializer as specified in Basic Authentication Scheme
Implementation is immutable and thread-safe. It can be used as either an HTTP request initializer
or an HTTP request execute interceptor. initialize(HttpRequest)
only sets itself as the
interceptor. Authentication is actually done in intercept(HttpRequest)
, which is
implemented using HttpHeaders.setBasicAuthentication(String, String)
.
- Since:
- 1.7
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the password.Returns the username.void
initialize
(HttpRequest request) Initializes a request.void
intercept
(HttpRequest request) Invoked at the start ofHttpRequest.execute()
before executing the HTTP request.
-
Field Details
-
username
-
password
-
-
Constructor Details
-
BasicAuthentication
-
-
Method Details
-
initialize
Description copied from interface:HttpRequestInitializer
Initializes a request.- Specified by:
initialize
in interfaceHttpRequestInitializer
- Parameters:
request
- HTTP request- Throws:
IOException
-
intercept
Description copied from interface:HttpExecuteInterceptor
Invoked at the start ofHttpRequest.execute()
before executing the HTTP request.- Specified by:
intercept
in interfaceHttpExecuteInterceptor
- Throws:
IOException
-
getUsername
Returns the username. -
getPassword
Returns the password.
-