java.lang.Object
io.avaje.http.client.BasicAuthIntercept
- All Implemented Interfaces:
RequestIntercept
Adds Basic Authorization header to requests.
-
Constructor Summary
ConstructorsConstructorDescriptionBasicAuthIntercept(String username, String password) Construct with the username and password. -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeRequest(HttpClientRequest request) Before the request has been made.static StringReturn Base64 encoding of username:passwordstatic StringReturn the Basic header value with the encoding of username:passwordMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.avaje.http.client.RequestIntercept
afterResponse
-
Constructor Details
-
BasicAuthIntercept
Construct with the username and password.
-
-
Method Details
-
header
Return the Basic header value with the encoding of username:passwordProvided as a helper method for code that wants the header value to then apply explicitly rather than using this as a request intercept.
- Returns:
"Basic " + encode(username, password)
-
encode
Return Base64 encoding of username:passwordProvided as a helper method for code that wants to encode the username password pair and use that explicitly rather than using this as a request intercept.
-
beforeRequest
Description copied from interface:RequestInterceptBefore the request has been made.Typically we can add headers or modify the request prior to it being sent.
- Specified by:
beforeRequestin interfaceRequestIntercept
-