|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.services.security.TurbineSecurity
This is a Facade class for SecurityService.
This class provides static methods that call related methods of the
implementation of SecurityService used by the System, according to
the settings in TurbineResources.
Certain Roles that the Users may have in the system may are not related
to any specific resource nor entity. They are assigned within a special group
named 'global' that can be referenced in the code as
Group.GLOBAL_GROUP_NAME
.
Constructor Summary | |
TurbineSecurity()
|
Method Summary | |
static boolean |
accountExists(java.lang.String userName)
Check whether a specified user's account exists. |
static boolean |
accountExists(User user)
Check whether a specified user's account exists. |
static void |
addGroup(Group group)
Creates a new group with specified attributes. |
static void |
addPermission(Permission permission)
Creates a new permission with specified attributes. |
static void |
addRole(Role role)
Creates a new role with specified attributes. |
static void |
addUser(User user,
java.lang.String password)
Creates new user account with specified attributes. |
static void |
changePassword(User user,
java.lang.String oldPassword,
java.lang.String newPassword)
Change the password for an User. |
static boolean |
checkPassword(java.lang.String checkpw,
java.lang.String encpw)
Checks if a supplied password matches the encrypted password |
static Group |
createGroup(java.lang.String name)
Creates a new Group in the system. |
static Permission |
createPermission(java.lang.String name)
Creates a new Permission in the system. |
static Role |
createRole(java.lang.String name)
Creates a new Role in the system. |
static java.lang.String |
encryptPassword(java.lang.String password)
This method provides client-side encryption of passwords. |
static java.lang.String |
encryptPassword(java.lang.String password,
java.lang.String salt)
This method provides client-side encryption of passwords. |
static void |
forcePassword(User user,
java.lang.String password)
Forcibly sets new password for an User. |
static AccessControlList |
getACL(User user)
Constructs an AccessControlList for a specific user. |
static GroupSet |
getAllGroups()
Retrieves all groups defined in the system. |
static PermissionSet |
getAllPermissions()
Retrieves all permissions defined in the system. |
static RoleSet |
getAllRoles()
Retrieves all roles defined in the system. |
static User |
getAnonymousUser()
Constructs an User object to represent an anonymous user of the application. |
static User |
getAuthenticatedUser(java.lang.String username,
java.lang.String password)
Authenticates an user, and constructs an User object to represent him/her. |
static Group |
getGlobalGroup()
Provides a reference to the Group object that represents the global group. |
static Group |
getGroup(java.lang.String groupName)
Deprecated. Use getGroupByName instead. |
static Group |
getGroupById(int groupId)
Retrieve a Group object with specified Id. |
static Group |
getGroupByName(java.lang.String groupName)
Retrieve a Group object with specified name. |
static java.lang.Class |
getGroupClass()
Returns the Class object for the implementation of Group interface used by the system. |
static Group |
getGroupInstance(java.lang.String groupName)
Construct a blank Group object. |
static GroupSet |
getGroups(org.apache.torque.util.Criteria criteria)
Retrieve a set of Groups that meet the specified Criteria. |
static Group |
getNewGroup(java.lang.String groupName)
Deprecated. Use getGroupInstance(String name) instead. |
static Permission |
getNewPermission(java.lang.String permissionName)
Deprecated. Use getPermissionInstance(String name) instead. |
static Role |
getNewRole(java.lang.String roleName)
Deprecated. Use getRoleInstance(String name) instead. |
static Permission |
getPermission(java.lang.String permissionName)
Deprecated. Use getPermissionByName instead. |
static Permission |
getPermissionById(int permissionId)
Retrieve a Permission object with specified Id. |
static Permission |
getPermissionByName(java.lang.String permissionName)
Retrieve a Permission object with specified name. |
static java.lang.Class |
getPermissionClass()
Returns the Class object for the implementation of Permission interface used by the system. |
static Permission |
getPermissionInstance(java.lang.String permName)
Construct a blank Permission object. |
static PermissionSet |
getPermissions(org.apache.torque.util.Criteria criteria)
Retrieve a set of Permissions that meet the specified Criteria. |
static PermissionSet |
getPermissions(Role role)
Retrieves all permissions associated with a role. |
static Role |
getRole(java.lang.String roleName)
Deprecated. Use getRoleByName instead. |
static Role |
getRoleById(int roleId)
Retrieve a Role object with specified Id. |
static Role |
getRoleByName(java.lang.String roleName)
Retrieve a Role object with specified name. |
static java.lang.Class |
getRoleClass()
Returns the Class object for the implementation of Role interface used by the system. |
static Role |
getRoleInstance(java.lang.String roleName)
Construct a blank Role object. |
static RoleSet |
getRoles(org.apache.torque.util.Criteria criteria)
Retrieve a set of Roles that meet the specified Criteria. |
static SecurityService |
getService()
Retrieves an implementation of SecurityService, base on the settings in TurbineResources. |
static User |
getUser(java.lang.String username)
Constructs an User object to represent a registered user of the application. |
static java.lang.Class |
getUserClass()
Returns the Class object for the implementation of User interface used by the system. |
static User |
getUserInstance()
Construct a blank User object. |
static java.util.List |
getUserList(org.apache.torque.util.Criteria criteria)
Retrieve a set of users that meet the specified criteria. |
static UserManager |
getUserManager()
Returns the configured UserManager. |
static User[] |
getUsers(org.apache.torque.util.Criteria criteria)
Retrieve a set of users that meet the specified criteria. |
static void |
grant(Role role,
Permission permission)
Grants a Role a Permission |
static void |
grant(User user,
Group group,
Role role)
Grant an User a Role in a Group. |
static boolean |
isAnonymousUser(User user)
Checks whether a passed user object matches the anonymous user pattern according to the configured service |
static void |
removeGroup(Group group)
Removes a Group from the system. |
static void |
removePermission(Permission permission)
Removes a Permission from the system. |
static void |
removeRole(Role role)
Removes a Role from the system. |
static void |
removeUser(User user)
Removes an user account from the system. |
static void |
renameGroup(Group group,
java.lang.String name)
Renames an existing Group. |
static void |
renamePermission(Permission permission,
java.lang.String name)
Renames an existing Permission. |
static void |
renameRole(Role role,
java.lang.String name)
Renames an existing Role. |
static void |
revoke(Role role,
Permission permission)
Revokes a Permission from a Role. |
static void |
revoke(User user,
Group group,
Role role)
Revoke a Role in a Group from an User. |
static void |
revokeAll(Role role)
Revokes all permissions from a Role. |
static void |
revokeAll(User user)
Revokes all roles from an User. |
static void |
saveGroup(Group group)
Stores Group's attributes. |
static void |
saveOnSessionUnbind(User user)
Saves User data when the session is unbound. |
static void |
savePermission(Permission permission)
Stores Permission's attributes. |
static void |
saveRole(Role role)
Stores Role's attributes. |
static void |
saveUser(User user)
Saves User's data in the permanent storage. |
void |
setUserManager(UserManager userManager)
Configure a new user Manager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TurbineSecurity()
Method Detail |
public static SecurityService getService()
public static java.lang.String encryptPassword(java.lang.String password)
password
- the password to process
public static java.lang.String encryptPassword(java.lang.String password, java.lang.String salt)
password
- the password to processsalt
- the supplied salt to encrypt the password
public static boolean checkPassword(java.lang.String checkpw, java.lang.String encpw)
checkpw
- The clear text password supplied by the userencpw
- The current, encrypted password
public static java.lang.Class getUserClass() throws UnknownEntityException
UnknownEntityException
- if the system's implementation of User
interface could not be determined.public static java.lang.Class getGroupClass() throws UnknownEntityException
UnknownEntityException
- if the system's implementation of Group
interface could not be determined.public static java.lang.Class getPermissionClass() throws UnknownEntityException
UnknownEntityException
- if the system's implementation of Permission
interface could not be determined.public static java.lang.Class getRoleClass() throws UnknownEntityException
UnknownEntityException
- if the system's implementation of Role
interface could not be determined.public static User getUserInstance() throws UnknownEntityException
UnknownEntityException
- if the object could not be instantiated.public static UserManager getUserManager()
public void setUserManager(UserManager userManager)
userManager
- An UserManager objectpublic static boolean accountExists(User user) throws DataBackendException
user
- The user to be checked.
DataBackendException
- if there was an error accessing the data
backend.public static boolean accountExists(java.lang.String userName) throws DataBackendException
userName
- The name of the user to be checked.
DataBackendException
- if there was an error accessing the data
backend.public static User getAuthenticatedUser(java.lang.String username, java.lang.String password) throws DataBackendException, UnknownEntityException, PasswordMismatchException
username
- The user name.password
- The user password.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if user account is not present.
PasswordMismatchException
- if the supplied password was incorrect.public static User getUser(java.lang.String username) throws DataBackendException, UnknownEntityException
username
- The user name.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if user account is not present.public static User[] getUsers(org.apache.torque.util.Criteria criteria) throws DataBackendException
User
interface, plus the names
of the custom attributes you added to your user representation
in the data storage. Use verbatim names of the attributes -
without table name prefix in case of DB implementation.
criteria
- The criteria of selection.
DataBackendException
- if there is a problem accessing the
storage.public static java.util.List getUserList(org.apache.torque.util.Criteria criteria) throws DataBackendException
User
interface, plus the names
of the custom attributes you added to your user representation
in the data storage. Use verbatim names of the attributes -
without table name prefix in case of DB implementation.
criteria
- The criteria of selection.
DataBackendException
- if there is a problem accessing the
storage.public static User getAnonymousUser() throws UnknownEntityException
UnknownEntityException
- if the anonymous User object couldn't be
constructed.public static boolean isAnonymousUser(User user)
user
- A user object
public static void saveUser(User user) throws UnknownEntityException, DataBackendException
user
- The User object to save.
UnknownEntityException
- if the user's account does not
exist in the database.
DataBackendException
- if there is a problem accessing the
storage.public static void saveOnSessionUnbind(User user) throws UnknownEntityException, DataBackendException
UnknownEntityException
- if the user's account does not
exist in the database.
DataBackendException
- if there is a problem accessing the
storage.public static void changePassword(User user, java.lang.String oldPassword, java.lang.String newPassword) throws PasswordMismatchException, UnknownEntityException, DataBackendException
user
- an User to change password for.oldPassword
- the current password supplied by the user.newPassword
- the current password requested by the user.
PasswordMismatchException
- if the supplied password was
incorrect.
UnknownEntityException
- if the user's record does not
exist in the database.
DataBackendException
- if there is a problem accessing the
storage.public static void forcePassword(User user, java.lang.String password) throws UnknownEntityException, DataBackendException
user
- an User to change password for.password
- the new password.
UnknownEntityException
- if the user's record does not
exist in the database.
DataBackendException
- if there is a problem accessing the
storage.public static AccessControlList getACL(User user) throws DataBackendException, UnknownEntityException
user
- the user for whom the AccessControlList are to be retrieved
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if user account is not present.public static void grant(User user, Group group, Role role) throws DataBackendException, UnknownEntityException
user
- the user.group
- the group.role
- the role.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if user account, group or role is not
present.public static void revoke(User user, Group group, Role role) throws DataBackendException, UnknownEntityException
user
- the user.group
- the group.role
- the role.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if user account, group or role is not
present.public static void revokeAll(User user) throws DataBackendException, UnknownEntityException
user
- the User.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the account is not present.public static void grant(Role role, Permission permission) throws DataBackendException, UnknownEntityException
role
- the Role.permission
- the Permission.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if role or permission is not present.public static void revoke(Role role, Permission permission) throws DataBackendException, UnknownEntityException
role
- the Role.permission
- the Permission.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if role or permission is not present.public static void revokeAll(Role role) throws DataBackendException, UnknownEntityException
role
- the Role
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the Role is not present.public static void addUser(User user, java.lang.String password) throws DataBackendException, EntityExistsException
user
- the object describing account to be created.password
- password for the new user
DataBackendException
- if there was an error accessing the data
backend.
EntityExistsException
- if the user account already exists.public static void removeUser(User user) throws DataBackendException, UnknownEntityException
user
- the object describing the account to be removed.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the user account is not present.public static Group getGlobalGroup()
public static Group createGroup(java.lang.String name) throws TurbineSecurityException
name
- The name of the new Group.
TurbineSecurityException
- if the Group could not be created.public static Permission createPermission(java.lang.String name) throws TurbineSecurityException
name
- The name of the new Permission.
TurbineSecurityException
- if the Permission could not be created.public static Role createRole(java.lang.String name) throws TurbineSecurityException
name
- The name of the Role.
TurbineSecurityException
- if the Role could not be created.public static Group getGroup(java.lang.String groupName) throws DataBackendException, UnknownEntityException
groupName
- The name of the Group to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the Group is not present.public static Group getGroupByName(java.lang.String groupName) throws DataBackendException, UnknownEntityException
groupName
- The name of the Group to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the Group is not present.public static Group getGroupById(int groupId) throws DataBackendException, UnknownEntityException
UnknownEntityException
- if the permission does not
exist in the database.
DataBackendException
- if there is a problem accessing the
storage.public static Group getGroupInstance(java.lang.String groupName) throws UnknownEntityException
groupName
- The name of the Group
UnknownEntityException
- if the object could not be instantiated.public static Group getNewGroup(java.lang.String groupName) throws DataBackendException
groupName
- The name of the Group to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.public static Role getRoleInstance(java.lang.String roleName) throws UnknownEntityException
roleName
- The name of the role.
UnknownEntityException
- if the object could not be instantiated.public static Role getNewRole(java.lang.String roleName) throws TurbineSecurityException
roleName
- The name of the Role to be retrieved.
TurbineSecurityException
- if the Role could not be retrievedpublic static Permission getPermissionInstance(java.lang.String permName) throws UnknownEntityException
permName
- The name of the permission.
UnknownEntityException
- if the object could not be instantiated.public static Permission getNewPermission(java.lang.String permissionName) throws DataBackendException
permissionName
- The name of the Permission to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.public static Role getRole(java.lang.String roleName) throws DataBackendException, UnknownEntityException
roleName
- The name of the Role to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the Role is not present.public static Role getRoleByName(java.lang.String roleName) throws DataBackendException, UnknownEntityException
roleName
- The name of the Role to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the Role is not present.public static Role getRoleById(int roleId) throws DataBackendException, UnknownEntityException
UnknownEntityException
- if the permission does not
exist in the database.
DataBackendException
- if there is a problem accessing the
storage.public static Permission getPermission(java.lang.String permissionName) throws DataBackendException, UnknownEntityException
permissionName
- The name of the Permission to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the Permission is not present.public static Permission getPermissionByName(java.lang.String permissionName) throws DataBackendException, UnknownEntityException
permissionName
- The name of the Permission to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the Permission is not present.public static Permission getPermissionById(int permissionId) throws DataBackendException, UnknownEntityException
UnknownEntityException
- if the permission does not
exist in the database.
DataBackendException
- if there is a problem accessing the
storage.public static GroupSet getGroups(org.apache.torque.util.Criteria criteria) throws DataBackendException
criteria
- A Criteria of Group selection.
DataBackendException
- if there was an error accessing the data
backend.public static RoleSet getRoles(org.apache.torque.util.Criteria criteria) throws DataBackendException
criteria
- a Criteria of Roles selection.
DataBackendException
- if there was an error accessing the data
backend.public static PermissionSet getPermissions(org.apache.torque.util.Criteria criteria) throws DataBackendException
criteria
- a Criteria of Permissions selection.
DataBackendException
- if there was an error accessing the data
backend.public static GroupSet getAllGroups() throws DataBackendException
DataBackendException
- if there was an error accessing the data
backend.public static RoleSet getAllRoles() throws DataBackendException
DataBackendException
- if there was an error accessing the data
backend.public static PermissionSet getAllPermissions() throws DataBackendException
DataBackendException
- if there was an error accessing the data
backend.public static PermissionSet getPermissions(Role role) throws DataBackendException, UnknownEntityException
role
- the role name, for which the permissions are to be retrieved.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the role is not present.public static void saveGroup(Group group) throws DataBackendException, UnknownEntityException
group
- The Group to be stored.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the group does not exist.public static void saveRole(Role role) throws DataBackendException, UnknownEntityException
role
- The Role to be stored.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the role does not exist.public static void savePermission(Permission permission) throws DataBackendException, UnknownEntityException
permission
- The Permission to be stored.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the permission does not exist.public static void addGroup(Group group) throws DataBackendException, EntityExistsException
group
- the object describing the group to be created.
DataBackendException
- if there was an error accessing the data
backend.
EntityExistsException
- if the group already exists.public static void addRole(Role role) throws DataBackendException, EntityExistsException
role
- the objects describing the role to be created.
DataBackendException
- if there was an error accessing the data
backend.
EntityExistsException
- if the role already exists.public static void addPermission(Permission permission) throws DataBackendException, EntityExistsException
permission
- the objects describing the permission to be created.
DataBackendException
- if there was an error accessing the data
backend.
EntityExistsException
- if the permission already exists.public static void removeGroup(Group group) throws DataBackendException, UnknownEntityException
group
- the object describing group to be removed.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the group does not exist.public static void removeRole(Role role) throws DataBackendException, UnknownEntityException
role
- The object describing the role to be removed.
DataBackendException
- if there was an error accessing the data backend.
UnknownEntityException
- if the role does not exist.public static void removePermission(Permission permission) throws DataBackendException, UnknownEntityException
permission
- The object describing the permission to be removed.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the permission does not exist.public static void renameGroup(Group group, java.lang.String name) throws DataBackendException, UnknownEntityException
group
- The object describing the group to be renamed.name
- the new name for the group.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the group does not exist.public static void renameRole(Role role, java.lang.String name) throws DataBackendException, UnknownEntityException
role
- The object describing the role to be renamed.name
- the new name for the role.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the role does not exist.public static void renamePermission(Permission permission, java.lang.String name) throws DataBackendException, UnknownEntityException
permission
- The object describing the permission to be renamed.name
- the new name for the permission.
DataBackendException
- if there was an error accessing the data
backend.
UnknownEntityException
- if the permission does not exist.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |