Package org.apache.jena.http.auth
Class AuthLib
- java.lang.Object
-
- org.apache.jena.http.auth.AuthLib
-
public class AuthLib extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description AuthLib()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.Authenticator
authenticator(java.lang.String user, java.lang.String password)
Create a JDKAuthenticator
for this (username and password).static <T> java.net.http.HttpResponse<T>
authExecute(java.net.http.HttpClient httpClient, java.net.http.HttpRequest httpRequest, java.net.http.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 java.net.PasswordAuthentication
getPasswordAuthentication(java.net.Authenticator authenticator)
Get thePasswordAuthentication
from anAuthenticator
-
-
-
Method Detail
-
authExecute
public static <T> java.net.http.HttpResponse<T> authExecute(java.net.http.HttpClient httpClient, java.net.http.HttpRequest httpRequest, java.net.http.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
-
authenticator
public static java.net.Authenticator authenticator(java.lang.String user, java.lang.String password)
Create a JDKAuthenticator
for this (username and password). The java.net.http as supplied only supports basic authentication.
-
getPasswordAuthentication
public static java.net.PasswordAuthentication getPasswordAuthentication(java.net.Authenticator authenticator)
Get thePasswordAuthentication
from anAuthenticator
-
-