Package org.apache.ivy.util.url
Class IvyAuthenticator
- java.lang.Object
-
- java.net.Authenticator
-
- org.apache.ivy.util.url.IvyAuthenticator
-
public final class IvyAuthenticator extends java.net.Authenticator
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.Authenticator
original
private static boolean
securityWarningLogged
-
Constructor Summary
Constructors Modifier Constructor Description private
IvyAuthenticator(java.net.Authenticator original)
Private c'tor to prevent instantiation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static java.net.Authenticator
getCurrentAuthenticator()
TheAuthenticator
doesn't have API before Java 9 to get hold of the current system levelAuthenticator
.private static java.net.Authenticator
getDefaultAuthenticator()
private static int
getJavaVersion()
protected java.net.PasswordAuthentication
getPasswordAuthentication()
private static java.net.Authenticator
getTheAuthenticator()
private static void
handleReflectionException(java.lang.Throwable t)
static void
install()
Installs an IvyAuthenticator as default Authenticator.private boolean
isProxyAuthentication()
Checks if the current authentication request is for the proxy server.-
Methods inherited from class java.net.Authenticator
getDefault, getRequestingHost, getRequestingPort, getRequestingPrompt, getRequestingProtocol, getRequestingScheme, getRequestingSite, getRequestingURL, getRequestorType, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthenticationInstance, setDefault
-
-
-
-
Method Detail
-
install
public static void install()
Installs an IvyAuthenticator as default Authenticator. Call this method before opening HTTP(S) connections to enable Ivy authentication.
-
getPasswordAuthentication
protected java.net.PasswordAuthentication getPasswordAuthentication()
- Overrides:
getPasswordAuthentication
in classjava.net.Authenticator
-
getCurrentAuthenticator
static java.net.Authenticator getCurrentAuthenticator()
TheAuthenticator
doesn't have API before Java 9 to get hold of the current system levelAuthenticator
. This method does a best-effort attempt to try and get hold of the currentAuthenticator
in a way that's specific to the implementation of this method. There's no guarantee that this method will return the current authenticator. Note: this method is intended to be used exclusively by tests.- Returns:
- Returns the currently setup system level
Authenticator
. In cases where this method isn't able to get the current authenticator, this method returns null
-
isProxyAuthentication
private boolean isProxyAuthentication()
Checks if the current authentication request is for the proxy server.
-
getDefaultAuthenticator
private static java.net.Authenticator getDefaultAuthenticator()
-
getTheAuthenticator
private static java.net.Authenticator getTheAuthenticator()
-
handleReflectionException
private static void handleReflectionException(java.lang.Throwable t)
-
getJavaVersion
private static int getJavaVersion()
-
-