net.sourceforge.pebble.security
Class DefaultSecurityRealm

java.lang.Object
  extended by net.sourceforge.pebble.security.DefaultSecurityRealm
All Implemented Interfaces:
SecurityRealm

public class DefaultSecurityRealm
extends java.lang.Object
implements SecurityRealm

Implementation of the SecurityRealm that gets authentication credentials from the blog directory.

Author:
Simon Brown

Field Summary
protected static java.lang.String DETAILS_UPDATEABLE
           
protected static java.lang.String EMAIL_ADDRESS
           
protected static java.lang.String NAME
           
protected static java.lang.String PASSWORD
           
protected static java.lang.String PREFERENCE
           
protected static java.lang.String PROFILE
           
protected static java.lang.String ROLES
           
protected static java.lang.String WEBSITE
           
 
Constructor Summary
DefaultSecurityRealm()
           
 
Method Summary
 void changePassword(java.lang.String username, java.lang.String password)
          Changes a user's password.
 void createUser(PebbleUserDetails pud)
          Creates a new user.
 Configuration getConfiguration()
           
protected  java.io.File getFileForRealm()
           
protected  java.io.File getFileForUser(java.lang.String username)
           
 PasswordEncoder getPasswordEncoder()
           
 SaltSource getSaltSource()
           
 PebbleUserDetails getUser(java.lang.String username)
          Looks up and returns user details for the given username.
 java.util.Collection<PebbleUserDetails> getUsers()
          Looks up and returns a collection of all users.
 void init()
          Creates the underlying security realm upon creation, if necessary.
 void removeUser(java.lang.String username)
          Removes user details for the given username.
 void setConfiguration(Configuration configuration)
           
 void setPasswordEncoder(PasswordEncoder passwordEncoder)
           
 void setSaltSource(SaltSource saltSource)
           
 void updateUser(PebbleUserDetails pud)
          Updates user details.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASSWORD

protected static final java.lang.String PASSWORD
See Also:
Constant Field Values

ROLES

protected static final java.lang.String ROLES
See Also:
Constant Field Values

NAME

protected static final java.lang.String NAME
See Also:
Constant Field Values

EMAIL_ADDRESS

protected static final java.lang.String EMAIL_ADDRESS
See Also:
Constant Field Values

WEBSITE

protected static final java.lang.String WEBSITE
See Also:
Constant Field Values

PROFILE

protected static final java.lang.String PROFILE
See Also:
Constant Field Values

DETAILS_UPDATEABLE

protected static final java.lang.String DETAILS_UPDATEABLE
See Also:
Constant Field Values

PREFERENCE

protected static final java.lang.String PREFERENCE
See Also:
Constant Field Values
Constructor Detail

DefaultSecurityRealm

public DefaultSecurityRealm()
Method Detail

init

public void init()
Creates the underlying security realm upon creation, if necessary.


getUsers

public java.util.Collection<PebbleUserDetails> getUsers()
                                                 throws SecurityRealmException
Looks up and returns a collection of all users.

Specified by:
getUsers in interface SecurityRealm
Returns:
a Collection of PebbleUserDetails objects
Throws:
SecurityRealmException

getUser

public PebbleUserDetails getUser(java.lang.String username)
                          throws SecurityRealmException
Looks up and returns user details for the given username.

Specified by:
getUser in interface SecurityRealm
Parameters:
username - the username to find details for
Returns:
a PebbleUserDetails instance
Throws:
SecurityRealmException

createUser

public void createUser(PebbleUserDetails pud)
                throws SecurityRealmException
Creates a new user.

Specified by:
createUser in interface SecurityRealm
Parameters:
pud - a PebbleUserDetails instance
Throws:
SecurityRealmException

updateUser

public void updateUser(PebbleUserDetails pud)
                throws SecurityRealmException
Updates user details.

Specified by:
updateUser in interface SecurityRealm
Parameters:
pud - a PebbleUserDetails instance
Throws:
SecurityRealmException

changePassword

public void changePassword(java.lang.String username,
                           java.lang.String password)
                    throws SecurityRealmException
Changes a user's password.

Specified by:
changePassword in interface SecurityRealm
Parameters:
username - the username of the user
password - the new password
Throws:
SecurityRealmException

removeUser

public void removeUser(java.lang.String username)
                throws SecurityRealmException
Removes user details for the given username.

Specified by:
removeUser in interface SecurityRealm
Parameters:
username - the username of the user to remove
Throws:
SecurityRealmException

getFileForRealm

protected java.io.File getFileForRealm()
                                throws SecurityRealmException
Throws:
SecurityRealmException

getFileForUser

protected java.io.File getFileForUser(java.lang.String username)
                               throws SecurityRealmException
Throws:
SecurityRealmException

getConfiguration

public Configuration getConfiguration()

setConfiguration

public void setConfiguration(Configuration configuration)

getPasswordEncoder

public PasswordEncoder getPasswordEncoder()

setPasswordEncoder

public void setPasswordEncoder(PasswordEncoder passwordEncoder)

getSaltSource

public SaltSource getSaltSource()

setSaltSource

public void setSaltSource(SaltSource saltSource)


Copyright © 2003-2006, Simon Brown. All Rights Reserved.