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.Authenticatororiginalprivate static booleansecurityWarningLogged
-
Constructor Summary
Constructors Modifier Constructor Description privateIvyAuthenticator(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.AuthenticatorgetCurrentAuthenticator()TheAuthenticatordoesn't have API before Java 9 to get hold of the current system levelAuthenticator.private static java.net.AuthenticatorgetDefaultAuthenticator()private static intgetJavaVersion()protected java.net.PasswordAuthenticationgetPasswordAuthentication()private static java.net.AuthenticatorgetTheAuthenticator()private static voidhandleReflectionException(java.lang.Throwable t)static voidinstall()Installs an IvyAuthenticator as default Authenticator.private booleanisProxyAuthentication()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:
getPasswordAuthenticationin classjava.net.Authenticator
-
getCurrentAuthenticator
static java.net.Authenticator getCurrentAuthenticator()
TheAuthenticatordoesn'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 currentAuthenticatorin 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()
-
-