public class PropertyAuthenticator
extends java.net.Authenticator
installInstance(boolean)
is provided to set this
authenticator up for use in all HTTP connection attempts.
Since this uses the same username and password for all web sites, it's obviously a bit of a blunt instrument. It may be refined at some point in the future.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PASSWORD_PROP
System property supplying basic authentication password ("star.basicauth.password").
|
static java.lang.String |
USER_PROP
System property supplying basic authentication username ("star.basicauth.user").
|
Constructor and Description |
---|
PropertyAuthenticator()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.net.PasswordAuthentication |
createAuthentication()
Returns a PasswordAuthentication instance suitable for use with
PropertyAuthenticator.
|
java.net.PasswordAuthentication |
getPasswordAuthentication() |
static boolean |
installInstance(boolean offerAdvice)
Installs an instance of PropertyAuthenticator so that it is used
automatically in response to all 401 Unauthorized HTTP responses.
|
getRequestingHost, getRequestingPort, getRequestingPrompt, getRequestingProtocol, getRequestingScheme, getRequestingSite, getRequestingURL, getRequestorType, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, setDefault
public static final java.lang.String USER_PROP
public static final java.lang.String PASSWORD_PROP
public java.net.PasswordAuthentication getPasswordAuthentication()
getPasswordAuthentication
in class java.net.Authenticator
public static java.net.PasswordAuthentication createAuthentication()
public static boolean installInstance(boolean offerAdvice)
offerAdvice
parameter is true, then if
the properties are not set up, an authenticator is installed which
issues a message advising how to use system properties to get
the authenticator working next time.offerAdvice
- if true, install an advising authenticator if the
property one isn't going to workofferAdvice
is true, will always return trueAuthenticator.setDefault(java.net.Authenticator)