public class BasicAuthInterceptor extends java.lang.Object implements HttpConnectionRequestInterceptor
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
authHeader |
protected java.lang.String |
encodedAuth |
| Modifier | Constructor and Description |
|---|---|
|
BasicAuthInterceptor(java.lang.String userinfo)
Constructs a
BasicAuthInterceptor using userinfo details. |
protected |
BasicAuthInterceptor(java.lang.String userinfo,
java.lang.String authHeader) |
| Modifier and Type | Method and Description |
|---|---|
static BasicAuthInterceptor |
createFromCredentials(java.lang.String username,
java.lang.String password)
Returns a
BasicAuthInterceptor configured using the username and password provided. |
HttpConnectionInterceptorContext |
interceptRequest(HttpConnectionInterceptorContext context)
Intercept the request.
|
protected final java.lang.String authHeader
protected final java.lang.String encodedAuth
public BasicAuthInterceptor(java.lang.String userinfo)
BasicAuthInterceptor using userinfo details.userinfo - the username and password separated by a single colon (":") characterprotected BasicAuthInterceptor(java.lang.String userinfo,
java.lang.String authHeader)
public static BasicAuthInterceptor createFromCredentials(java.lang.String username, java.lang.String password)
BasicAuthInterceptor configured using the username and password provided.username - the username to usepassword - the password to useBasicAuthInterceptorpublic HttpConnectionInterceptorContext interceptRequest(HttpConnectionInterceptorContext context)
HttpConnectionRequestInterceptorHttpURLConnection which
initiate a request such as HttpURLConnection.getResponseCode()interceptRequest in interface HttpConnectionRequestInterceptorcontext - Input context