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 TypeMethodDescriptionvoidconfigureClientBuilder(URI baseURI, org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder) voidconfigureRequest(URI baseURI, org.apache.hc.client5.http.classic.methods.HttpUriRequest request, org.apache.hc.client5.http.protocol.HttpClientContext httpClientContext) voidinitializeConnection(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, waitMethods 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:
configureClientBuilderin 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:
configureRequestin interfaceCredentialsProvider- Throws:
org.apache.hc.client5.http.auth.AuthenticationException
-
initializeConnection
Description copied from interface:CredentialsProviderInitialize 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:
initializeConnectionin interfaceCredentialsProvider- Throws:
IOExceptionCommandException
-