org.pfsw.security.authentication
Class LocationCredentials

java.lang.Object
  extended by org.pfsw.security.authentication.LocationCredentials

public class LocationCredentials
extends java.lang.Object

Holds the userId and a password for a collection of URL patterns.


Constructor Summary
LocationCredentials(java.lang.String userId, java.lang.String password)
          Initialize the new instance with a userId and corresponding passwords.
LocationCredentials(java.lang.String realm, java.lang.String userId, java.lang.String password)
          Initialize the new instance with a userId and corresponding passwords.
 
Method Summary
 void addPattern(java.lang.String pattern)
          Adds the given pattern to the URL patterns that can be accessed with this object's authentication credentials.
 void addPattern(org.pfsw.text.StringPattern pattern)
          Adds the given pattern to the URL patterns that can be accessed with this object's authentication credentials.
 boolean appliesTo(java.lang.String realm, java.lang.String url)
          Returns true if the given realm and URL match the settings in this object.
 boolean appliesToRealm(java.lang.String realm)
          Returns true if the given realm matches the realm name of this object.
 boolean appliesToURL(java.lang.String url)
          Returns true if the given URL matches any of the underlying patterns.
protected  void fillCredentials()
          Subclasses must override this method in order to get the credentials from somewhere and set a PasswordAuthentication object using setCredentials().
protected  java.net.PasswordAuthentication getCredentials()
           
protected  org.pfsw.text.StringPatternCollection getLocationPatterns()
           
 java.net.PasswordAuthentication getPasswordAuthentication()
          Returns the password based authentication data.
 java.lang.String getRealm()
          Returns the realm this credentials apply to
protected  java.lang.String getRealmName()
           
protected  java.lang.String getUserId()
           
protected  void setCredentials(java.net.PasswordAuthentication newValue)
           
protected  void setLocationPatterns(org.pfsw.text.StringPatternCollection newValue)
           
 void setRealm(java.lang.String realm)
          Sets the realm this credentials apply to
protected  void setRealmName(java.lang.String newValue)
           
protected  void setUserId(java.lang.String newValue)
           
protected  org.pfsw.text.StringUtil str()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationCredentials

public LocationCredentials(java.lang.String userId,
                           java.lang.String password)
Initialize the new instance with a userId and corresponding passwords. URL patterns can be added later with method addPattern().

Parameters:
userId - The userId to be used for authentication
password - The password to be used for authentication

LocationCredentials

public LocationCredentials(java.lang.String realm,
                           java.lang.String userId,
                           java.lang.String password)
Initialize the new instance with a userId and corresponding passwords. URL patterns can be added later with method addPattern().

Parameters:
realm - The realm that is accessible with the given credentials
userId - The userId to be used for authentication
password - The password to be used for authentication
Method Detail

getPasswordAuthentication

public java.net.PasswordAuthentication getPasswordAuthentication()
Returns the password based authentication data.


getRealm

public java.lang.String getRealm()
Returns the realm this credentials apply to


setRealm

public void setRealm(java.lang.String realm)
Sets the realm this credentials apply to


addPattern

public void addPattern(java.lang.String pattern)
Adds the given pattern to the URL patterns that can be accessed with this object's authentication credentials.

Parameters:
pattern - A URL pattern that might contain '*' as wildcards.

addPattern

public void addPattern(org.pfsw.text.StringPattern pattern)
Adds the given pattern to the URL patterns that can be accessed with this object's authentication credentials.

Parameters:
pattern - A URL pattern that might contain '*' as wildcards.

appliesTo

public boolean appliesTo(java.lang.String realm,
                         java.lang.String url)
Returns true if the given realm and URL match the settings in this object.


appliesToURL

public boolean appliesToURL(java.lang.String url)
Returns true if the given URL matches any of the underlying patterns.


appliesToRealm

public boolean appliesToRealm(java.lang.String realm)
Returns true if the given realm matches the realm name of this object.


fillCredentials

protected void fillCredentials()
Subclasses must override this method in order to get the credentials from somewhere and set a PasswordAuthentication object using setCredentials(). The userId might be set already and can be accessed via getUserId().


getRealmName

protected java.lang.String getRealmName()

setRealmName

protected void setRealmName(java.lang.String newValue)

getLocationPatterns

protected org.pfsw.text.StringPatternCollection getLocationPatterns()

setLocationPatterns

protected void setLocationPatterns(org.pfsw.text.StringPatternCollection newValue)

getUserId

protected java.lang.String getUserId()

setUserId

protected void setUserId(java.lang.String newValue)

getCredentials

protected java.net.PasswordAuthentication getCredentials()

setCredentials

protected void setCredentials(java.net.PasswordAuthentication newValue)

str

protected org.pfsw.text.StringUtil str()