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.voidinitialize(HttpRequest request) Initializes a request.voidintercept(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:HttpRequestInitializerInitializes a request.- Specified by:
initializein interfaceHttpRequestInitializer- Parameters:
request- HTTP request- Throws:
IOException
-
intercept
Description copied from interface:HttpExecuteInterceptorInvoked at the start ofHttpRequest.execute()before executing the HTTP request.- Specified by:
interceptin interfaceHttpExecuteInterceptor- Throws:
IOException
-
getUsername
Returns the username. -
getPassword
Returns the password.
-