java.lang.Object
org.apache.jena.http.auth.AuthLib
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Authenticator
authenticator
(String user, String password) Create a JDKAuthenticator
for this (username and password).static <T> HttpResponse<T>
authExecute
(HttpClient httpClient, HttpRequest httpRequest, HttpResponse.BodyHandler<T> bodyHandler) CallHttpClient.send(java.net.http.HttpRequest, java.net.http.HttpResponse.BodyHandler<T>)
after applying an activeAuthRequestModifier
to modify theHttpRequest.Builder
.static String
Decode from base64.static String
Encode in base64.static PasswordAuthentication
getPasswordAuthentication
(Authenticator authenticator) Get thePasswordAuthentication
from anAuthenticator
-
Constructor Details
-
AuthLib
public AuthLib()
-
-
Method Details
-
authExecute
public static <T> HttpResponse<T> authExecute(HttpClient httpClient, HttpRequest httpRequest, HttpResponse.BodyHandler<T> bodyHandler) CallHttpClient.send(java.net.http.HttpRequest, java.net.http.HttpResponse.BodyHandler<T>)
after applying an activeAuthRequestModifier
to modify theHttpRequest.Builder
. If noAuthRequestModifier
is available and if a 401 response is received, setup aAuthRequestModifier
passed on registered username and password information. This function supports basic and digest authentication.- Parameters:
httpClient
- HttpClienthttpRequest
-bodyHandler
-- Returns:
- HttpResponse<T>
-
authenticator
Create a JDKAuthenticator
for this (username and password). The java.net.http as supplied only supports basic authentication. -
getPasswordAuthentication
Get thePasswordAuthentication
from anAuthenticator
-
base64enc
Encode in base64. -
base64dec
Decode from base64. Return null if the decoding failed.
-