java.lang.Object
org.apache.jena.http.auth.AuthLib
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Authenticatorauthenticator(String user, String password) Create a JDKAuthenticatorfor this (username and password).static <T> HttpResponse<T>authExecute(HttpClient httpClient, HttpRequest httpRequest, HttpResponse.BodyHandler<T> bodyHandler) static <T> CompletableFuture<HttpResponse<T>>authExecuteAsync(HttpClient httpClient, HttpRequest httpRequest, HttpResponse.BodyHandler<T> bodyHandler) CallHttpClient.sendAsync(java.net.http.HttpRequest, java.net.http.HttpResponse.BodyHandler<T>)after applying an activeAuthRequestModifierto modify theHttpRequest.Builder.static StringDecode from base64.static StringEncode in base64.static PasswordAuthenticationgetPasswordAuthentication(Authenticator authenticator) Get thePasswordAuthenticationfrom anAuthenticator
-
Constructor Details
-
AuthLib
public AuthLib()
-
-
Method Details
-
authExecute
public static <T> HttpResponse<T> authExecute(HttpClient httpClient, HttpRequest httpRequest, HttpResponse.BodyHandler<T> bodyHandler) Call theHttpClientafter applying an activeAuthRequestModifierto modify theHttpRequest.Builder. If noAuthRequestModifieris available and if a 401 response is received, setup aAuthRequestModifierpassed on registered username and password information. This function supports basic and digest authentication.- Parameters:
httpClient- HttpClienthttpRequest-bodyHandler-- Returns:
- HttpResponse<T>
-
authExecuteAsync
public static <T> CompletableFuture<HttpResponse<T>> authExecuteAsync(HttpClient httpClient, HttpRequest httpRequest, HttpResponse.BodyHandler<T> bodyHandler) CallHttpClient.sendAsync(java.net.http.HttpRequest, java.net.http.HttpResponse.BodyHandler<T>)after applying an activeAuthRequestModifierto modify theHttpRequest.Builder. If noAuthRequestModifieris available and if a 401 response is received, setup aAuthRequestModifierpassed on registered username and password information. This function supports basic and digest authentication.- Parameters:
httpClient- HttpClienthttpRequest-bodyHandler-- Returns:
- CompletableFuture<HttpResponse<T>>
-
authenticator
Create a JDKAuthenticatorfor this (username and password). The java.net.http as supplied only supports basic authentication. -
getPasswordAuthentication
Get thePasswordAuthenticationfrom anAuthenticator -
base64enc
Encode in base64. -
base64dec
Decode from base64. Return null if the decoding failed.
-