Class BasicAuthenticationHandler
java.lang.Object
org.eclipse.rdf4j.http.client.spi.BasicAuthenticationHandler
- All Implemented Interfaces:
AuthenticationHandler
AuthenticationHandler that adds HTTP Basic authentication credentials to every request.
The Authorization: Basic <base64> header is computed once at construction time and appended to every
request passed to authenticate(HttpRequest).
Example usage:
SPARQLProtocolSession session = ...;
session.setAuthenticationHandler(new BasicAuthenticationHandler("user", "secret"));
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBasicAuthenticationHandler(String username, String password) Creates a newBasicAuthenticationHandlerfor the given credentials. -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticate(HttpRequest request) Applies authentication credentials to the given request by modifying it in place.
-
Constructor Details
-
BasicAuthenticationHandler
Creates a newBasicAuthenticationHandlerfor the given credentials.- Parameters:
username- the username; must not benullpassword- the password; must not benull
-
-
Method Details
-
authenticate
Description copied from interface:AuthenticationHandlerApplies authentication credentials to the given request by modifying it in place.- Specified by:
authenticatein interfaceAuthenticationHandler- Parameters:
request- the outgoing HTTP request to authenticate; nevernull
-