|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.Authenticator
uk.ac.starlink.util.PropertyAuthenticator
public class PropertyAuthenticator
Authenticator implementation which uses system properties to set
fixed username and passwords for HTTP Basic Authentication.
The username and password are acquired from the system properties
"star.basicauth.user" and "star.basicauth.password".
A convenience method 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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.net.Authenticator |
---|
Authenticator.RequestorType |
Field Summary | |
---|---|
static String |
PASSWORD_PROP
System property supplying basic authentication password ("star.basicauth.password"). |
static String |
USER_PROP
System property supplying basic authentication username ("star.basicauth.user"). |
Constructor Summary | |
---|---|
PropertyAuthenticator()
Constructor. |
Method Summary | |
---|---|
static PasswordAuthentication |
createAuthentication()
Returns a PasswordAuthentication instance suitable for use with PropertyAuthenticator. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String USER_PROP
public static final String PASSWORD_PROP
Constructor Detail |
---|
public PropertyAuthenticator()
Method Detail |
---|
public PasswordAuthentication getPasswordAuthentication()
getPasswordAuthentication
in class Authenticator
public static 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 work
offerAdvice
is true, will always return trueAuthenticator.setDefault(java.net.Authenticator)
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |