|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.Authenticator
org.pfsw.security.authentication.AutoAuthenticationManager
public class AutoAuthenticationManager
This manager class is responsible to hold a registry of LocationCredentials
objects. With the method aboutToAccess( URL ) it selects the appropriate
Authenticator from its regestry and sets in as default into the
java.net.Authenticator class. That allows to do automatic authentication for
different (URLs).
Be aware that this code is not thread-safe!
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.net.Authenticator |
---|
java.net.Authenticator.RequestorType |
Field Summary | |
---|---|
protected static org.pfsw.text.Version |
HOST_SUPPORT_VERSION
|
protected static org.pfsw.text.Version |
JAVA_VERSION
|
Method Summary | |
---|---|
boolean |
aboutToAccess(java.lang.String url)
This method must be called to activate the authenticator that provides credentials to be able to access the given URL. |
boolean |
aboutToAccess(java.net.URL url)
This method must be called to activate the authenticator that provides credentials to be able to access the given URL. |
protected void |
fillFallbackAuthenticator()
|
protected LocationCredentials |
findCredentialsFor(java.lang.String url)
|
protected LocationCredentials |
findCredentialsForRealm()
|
protected LocationCredentials |
findCredentialsForRealm(java.lang.String realm)
|
protected java.net.PasswordAuthentication |
findPasswordAuthenticationForRealm()
|
protected LocationCredentials |
getActiveCredentials()
|
protected LocationCredentials |
getCredentials(java.lang.String id)
Returns the location credentials registered under the specified key or null if not found. |
AbstractAuthenticator |
getFallbackAuthenticator()
Returns the fallback authenticator which will be called if no credentials can be found in the registered credtentials. |
protected java.util.Map<java.lang.String,LocationCredentials> |
getLocationCredentials()
|
protected java.net.PasswordAuthentication |
getPasswordAuthentication()
|
protected boolean |
hasActiveCredentials()
|
static AutoAuthenticationManager |
install()
Must be called once, to activate this authentication manager mechanism within the java.net.Authenticator. |
static AutoAuthenticationManager |
instance()
Returns the only instance this class supports (design pattern "Singleton") |
protected boolean |
isBasicHttp()
|
void |
register(java.lang.String id,
LocationCredentials credentials)
Registers the given location credentials under the specified id. |
LocationCredentials |
remove(java.lang.String id)
Removes the location credentials registered under the specified key from the registry. |
void |
reset()
Removes all registered credentials and the fallback authenticator. |
protected void |
setActiveCredentials(LocationCredentials newValue)
|
void |
setFallbackAuthenticator(AbstractAuthenticator newValue)
Sets the fallback authenticator which will be called if no credentials can be found in the registered credtentials. |
protected void |
setLocationCredentials(java.util.Map<java.lang.String,LocationCredentials> newValue)
|
protected org.pfsw.text.StringUtil |
str()
|
protected boolean |
supportsHostNames()
|
static void |
uninstall()
Can be called to remove this authentication manager from the java.net.Authenticator. |
Methods inherited from class java.net.Authenticator |
---|
getRequestingHost, getRequestingPort, getRequestingPrompt, getRequestingProtocol, getRequestingScheme, getRequestingSite, getRequestingURL, getRequestorType, requestPasswordAuthentication, requestPasswordAuthentication, requestPasswordAuthentication, setDefault |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.pfsw.text.Version HOST_SUPPORT_VERSION
protected static final org.pfsw.text.Version JAVA_VERSION
Method Detail |
---|
public static AutoAuthenticationManager install()
public static void uninstall()
public static AutoAuthenticationManager instance()
public AbstractAuthenticator getFallbackAuthenticator()
public void setFallbackAuthenticator(AbstractAuthenticator newValue)
public boolean aboutToAccess(java.lang.String url)
url
- The URL that might need authentication to be accessed
public boolean aboutToAccess(java.net.URL url)
url
- The URL that might need authentication to be accessed
public void register(java.lang.String id, LocationCredentials credentials)
public LocationCredentials remove(java.lang.String id)
public void reset()
protected java.net.PasswordAuthentication getPasswordAuthentication()
getPasswordAuthentication
in class java.net.Authenticator
protected java.net.PasswordAuthentication findPasswordAuthenticationForRealm()
protected LocationCredentials getCredentials(java.lang.String id)
protected LocationCredentials findCredentialsFor(java.lang.String url)
protected LocationCredentials findCredentialsForRealm()
protected LocationCredentials findCredentialsForRealm(java.lang.String realm)
protected void fillFallbackAuthenticator()
protected boolean hasActiveCredentials()
protected boolean isBasicHttp()
protected boolean supportsHostNames()
protected java.util.Map<java.lang.String,LocationCredentials> getLocationCredentials()
protected void setLocationCredentials(java.util.Map<java.lang.String,LocationCredentials> newValue)
protected LocationCredentials getActiveCredentials()
protected void setActiveCredentials(LocationCredentials newValue)
protected org.pfsw.text.StringUtil str()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |