Package org.labkey.remoteapi
Class NetrcCredentialsProvider
java.lang.Object
org.labkey.remoteapi.NetrcCredentialsProvider
- All Implemented Interfaces:
CredentialsProvider
Attempts to find a .netrc or _netrc file and entry for the given host. If found, it will attempt basic auth using
the email and password in the entry. If file or entry are not found, it connects as guest.
-
Constructor Summary
ConstructorsConstructorDescriptionAttempt netrc lookup for the given host.NetrcCredentialsProvider
(URI baseURI) Attempt netrc lookup for the URI's host. -
Method Summary
Modifier and TypeMethodDescriptionvoid
configureClientBuilder
(URI baseURI, org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder) void
configureRequest
(URI baseURI, org.apache.hc.client5.http.classic.methods.HttpUriRequest request, org.apache.hc.client5.http.protocol.HttpClientContext httpClientContext) void
initializeConnection
(Connection connection) Initialize the connection before its first request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.labkey.remoteapi.CredentialsProvider
shouldRetryRequest
-
Constructor Details
-
NetrcCredentialsProvider
Attempt netrc lookup for the URI's host.- Parameters:
baseURI
- A valid base URI from which we'll extract the host name.- Throws:
IOException
- if there is an IO problem reading from the netrc file
-
NetrcCredentialsProvider
Attempt netrc lookup for the given host.- Parameters:
host
- Just the host name, e.g., "www.labkey.org" or "localhost"- Throws:
IOException
- if there is an IO problem reading from the netrc file
-
-
Method Details
-
configureClientBuilder
public void configureClientBuilder(URI baseURI, org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder) - Specified by:
configureClientBuilder
in interfaceCredentialsProvider
-
configureRequest
public void configureRequest(URI baseURI, org.apache.hc.client5.http.classic.methods.HttpUriRequest request, org.apache.hc.client5.http.protocol.HttpClientContext httpClientContext) throws org.apache.hc.client5.http.auth.AuthenticationException - Specified by:
configureRequest
in interfaceCredentialsProvider
- Throws:
org.apache.hc.client5.http.auth.AuthenticationException
-
initializeConnection
Description copied from interface:CredentialsProvider
Initialize the connection before its first request. For example, make a request to retrieve CSRF token & session ID and/or ensure the user is logged in.- Specified by:
initializeConnection
in interfaceCredentialsProvider
- Throws:
IOException
CommandException
-