jrun.security
Class JRunUserManagerService

jrunx.kernel.ServiceAdapter
  |
  +--jrun.security.JRunUserManagerService
All Implemented Interfaces:
JRunUserManager, JRunUserManagerServiceMBean, javax.naming.Referenceable, java.io.Serializable, Service, ServiceMBean

public class JRunUserManagerService
extends ServiceAdapter
implements JRunUserManager

User Manager interface to create, read, update, delete User and Role Information This is an implementation of the default User store in JRun to be used by the default Login mechanism and by users who wish to access this programatically The Appropriate permissions should be set up in the policy file before members of this class can be accessed.

See Also:
Serialized Form

Field Summary
static java.lang.String JRUN_USERS
           
 
Fields inherited from class jrunx.kernel.ServiceAdapter
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER
 
Fields inherited from interface jrun.security.JRunUserManager
END, EXPLICIT, IMMEDIATE
 
Fields inherited from interface jrun.security.JRunUserManagerServiceMBean
OBJECT_NAME
 
Fields inherited from interface jrunx.kernel.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
JRunUserManagerService()
           
 
Method Summary
 boolean addRole(java.lang.String roleName, java.lang.String description)
           
 boolean addUser(java.lang.String username, java.lang.String password, java.lang.String description)
           
 int addUsersToRole(java.lang.String rolename, java.util.Collection usernames)
          Adds the users corresponding to a collection of usernames to the specified role Returns the number of users added.
 boolean addUserToRole(java.lang.String rolename, java.lang.String username)
           
 boolean changePassword(java.lang.String username, java.lang.String oldpassword, java.lang.String newpassword)
           
 boolean changeRoleDescription(java.lang.String rolename, java.lang.String newdescription)
          return true if the description was changed, false otherwise
 boolean changeUserDescription(java.lang.String username, java.lang.String newdescription)
          returns true if the description was changed, false otherwise
 void clearAll()
           
 void destroy()
          Every service is eventually destroyed.
protected  void exportSecurityStore(java.lang.String filename)
          Writes out the user information in the cache to the security store called explicitly,at the end on destroy or automatically after an update depending on the persistTrigger setting
 java.lang.String getEncrypterClass()
          name of pluggable encryption class that implements JRunCrypter.
static JRunUserManager getJRunUserManager(java.lang.String objectName)
           
 char[] getPassword(java.lang.String username)
           
 java.lang.String getPasswordString(java.lang.String username)
           
 java.lang.String getRoleDescription(java.lang.String roleName)
          returns the description for this role, null if no description found
 java.util.Collection getRoles(java.lang.String userName)
          return a Collection of Strings containing rolenames this user blongs to passing in a null userName will return all the rolenames passing in an invalid userName will return an empty Collection Always return a Collection implementation that is Serializable for remote use ArrayList is Serializable.Set is not
 java.lang.String getSecurityStore()
           
 java.lang.String getUserDescription(java.lang.String userName)
          returns the description for this user, null if no description found
 java.util.Collection getUsers(java.lang.String roleName)
          return a Collection of Strings containing usernames in this role passing in a null roleName will return all the usernames passing in an invalid roleName will return an empty Collection Ensure that the returned Collecton is serializable for remote usage
protected  void importSecurityStore(java.lang.String fileName)
          Reads the securityStore file and stores it in the UserManager cache This method is called when the UserManager Service starts up.
 void init()
          Not every service needs to init, implement it out of convenience.
 boolean isEncrypted()
           
 boolean isRole(java.lang.String rolename)
           
 boolean isUser(java.lang.String username)
           
 boolean isUserInRole(java.lang.String username, java.lang.String rolename)
          check whether username belongs to rolename
 boolean removeFromRole(java.lang.String rolename, java.lang.String username)
           
 boolean removeRole(java.lang.String roleName)
           
 boolean removeUser(java.lang.String username)
           
 void setEncrypted(boolean encrypted)
           
 void setEncrypterClass(java.lang.String encrypterClassName)
           
static void setJRunUserManager(JRunUserManager um)
           
 void setSecurityStore(java.lang.String storename)
           
 void stop()
          Every service other than mere data collections should stop
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, start, toString, unbind, unscheduleRunnable, updateStatus
 
Methods inherited from interface jrunx.kernel.ServiceMBean
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind
 
Methods inherited from interface jrunx.kernel.Service
getStatus, start, updateStatus
 

Field Detail

JRUN_USERS

public static final java.lang.String JRUN_USERS
Constructor Detail

JRunUserManagerService

public JRunUserManagerService()
Method Detail

getJRunUserManager

public static JRunUserManager getJRunUserManager(java.lang.String objectName)

setJRunUserManager

public static void setJRunUserManager(JRunUserManager um)

init

public void init()
          throws java.lang.Exception
Description copied from class: ServiceAdapter
Not every service needs to init, implement it out of convenience.
Specified by:
init in interface Service
Overrides:
init in class ServiceAdapter

destroy

public void destroy()
             throws java.lang.Exception
Description copied from class: ServiceAdapter
Every service is eventually destroyed. Convenience implementation.
Specified by:
destroy in interface Service
Overrides:
destroy in class ServiceAdapter

stop

public void stop()
          throws java.lang.Exception
Description copied from class: ServiceAdapter
Every service other than mere data collections should stop
Specified by:
stop in interface Service
Overrides:
stop in class ServiceAdapter

setSecurityStore

public void setSecurityStore(java.lang.String storename)
Specified by:
setSecurityStore in interface JRunUserManagerServiceMBean

getSecurityStore

public java.lang.String getSecurityStore()
Specified by:
getSecurityStore in interface JRunUserManagerServiceMBean

getEncrypterClass

public java.lang.String getEncrypterClass()
Description copied from interface: JRunUserManagerServiceMBean
name of pluggable encryption class that implements JRunCrypter. Defaults to JRunCrypterImpl
Specified by:
getEncrypterClass in interface JRunUserManagerServiceMBean

setEncrypterClass

public void setEncrypterClass(java.lang.String encrypterClassName)
Specified by:
setEncrypterClass in interface JRunUserManagerServiceMBean

isUser

public boolean isUser(java.lang.String username)
Specified by:
isUser in interface JRunUserManagerServiceMBean

isRole

public boolean isRole(java.lang.String rolename)
Specified by:
isRole in interface JRunUserManagerServiceMBean

addUser

public boolean addUser(java.lang.String username,
                       java.lang.String password,
                       java.lang.String description)
Specified by:
addUser in interface JRunUserManagerServiceMBean

addRole

public boolean addRole(java.lang.String roleName,
                       java.lang.String description)
Specified by:
addRole in interface JRunUserManagerServiceMBean

addUserToRole

public boolean addUserToRole(java.lang.String rolename,
                             java.lang.String username)
Specified by:
addUserToRole in interface JRunUserManagerServiceMBean

addUsersToRole

public int addUsersToRole(java.lang.String rolename,
                          java.util.Collection usernames)
Adds the users corresponding to a collection of usernames to the specified role Returns the number of users added. Caller can check the return value for errors.
Specified by:
addUsersToRole in interface JRunUserManagerServiceMBean

removeUser

public boolean removeUser(java.lang.String username)
Specified by:
removeUser in interface JRunUserManagerServiceMBean

removeFromRole

public boolean removeFromRole(java.lang.String rolename,
                              java.lang.String username)
Specified by:
removeFromRole in interface JRunUserManagerServiceMBean

removeRole

public boolean removeRole(java.lang.String roleName)
Specified by:
removeRole in interface JRunUserManagerServiceMBean

getPassword

public char[] getPassword(java.lang.String username)
Specified by:
getPassword in interface JRunUserManagerServiceMBean

getPasswordString

public java.lang.String getPasswordString(java.lang.String username)
Specified by:
getPasswordString in interface JRunUserManagerServiceMBean

getUsers

public java.util.Collection getUsers(java.lang.String roleName)
return a Collection of Strings containing usernames in this role passing in a null roleName will return all the usernames passing in an invalid roleName will return an empty Collection Ensure that the returned Collecton is serializable for remote usage
Specified by:
getUsers in interface JRunUserManagerServiceMBean

getRoles

public java.util.Collection getRoles(java.lang.String userName)
return a Collection of Strings containing rolenames this user blongs to passing in a null userName will return all the rolenames passing in an invalid userName will return an empty Collection Always return a Collection implementation that is Serializable for remote use ArrayList is Serializable.Set is not
Specified by:
getRoles in interface JRunUserManagerServiceMBean

isUserInRole

public boolean isUserInRole(java.lang.String username,
                            java.lang.String rolename)
check whether username belongs to rolename
Specified by:
isUserInRole in interface JRunUserManagerServiceMBean

clearAll

public void clearAll()
Specified by:
clearAll in interface JRunUserManagerServiceMBean

isEncrypted

public boolean isEncrypted()
Specified by:
isEncrypted in interface JRunUserManagerServiceMBean

setEncrypted

public void setEncrypted(boolean encrypted)
Specified by:
setEncrypted in interface JRunUserManagerServiceMBean

getRoleDescription

public java.lang.String getRoleDescription(java.lang.String roleName)
returns the description for this role, null if no description found
Specified by:
getRoleDescription in interface JRunUserManagerServiceMBean

getUserDescription

public java.lang.String getUserDescription(java.lang.String userName)
returns the description for this user, null if no description found
Specified by:
getUserDescription in interface JRunUserManagerServiceMBean

changeUserDescription

public boolean changeUserDescription(java.lang.String username,
                                     java.lang.String newdescription)
returns true if the description was changed, false otherwise
Specified by:
changeUserDescription in interface JRunUserManagerServiceMBean

changeRoleDescription

public boolean changeRoleDescription(java.lang.String rolename,
                                     java.lang.String newdescription)
return true if the description was changed, false otherwise
Specified by:
changeRoleDescription in interface JRunUserManagerServiceMBean

importSecurityStore

protected void importSecurityStore(java.lang.String fileName)
                            throws java.lang.Exception
Reads the securityStore file and stores it in the UserManager cache This method is called when the UserManager Service starts up.

exportSecurityStore

protected void exportSecurityStore(java.lang.String filename)
                            throws java.lang.Exception
Writes out the user information in the cache to the security store called explicitly,at the end on destroy or automatically after an update depending on the persistTrigger setting

changePassword

public boolean changePassword(java.lang.String username,
                              java.lang.String oldpassword,
                              java.lang.String newpassword)
Specified by:
changePassword in interface JRunUserManagerServiceMBean


Copyright � 2002 Macromedia Corporation. All Rights Reserved.