|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.xmlserv.security.SecurityManager
This is currently the intended Baseclass for all SecurityManager implementations.
Warning: Default is 'allow' ...
It defines objects and methods intended for a role-based security system
incorporating the following objects:
Inner Class Summary | |
class |
SecurityManager.AccessRight
Abstraction of access to a resource. |
class |
SecurityManager.Authorization
Abstraction of authorization. |
class |
SecurityManager.Resource
Inner class encapsulating a named resource. |
class |
SecurityManager.Role
A role is a collection of access rights. |
class |
SecurityManager.User
This inner class encapsulates user credentials. |
Field Summary | |
static java.lang.String |
DELETE
Remove an object. |
static java.lang.String |
INSERT
Create a new object. |
static java.lang.String |
SELECT
Constant signifying SEARCH access: List objects and read object data. |
static java.lang.String |
UPDATE
Update an existing object. |
Constructor Summary | |
SecurityManager()
Empty default constructor. |
Method Summary | |
org.jdom.Element |
addACL(org.jdom.Element el,
SecurityManager.Resource resource,
SecurityManager.User user)
Add the ACL attributes can_select, can_isnert, can_update and can_delete according to the given users access rights on the given resource. |
SecurityManager.User |
authenticate(java.lang.String username,
java.lang.String password)
Check if a valid user account/password combination is given. |
SecurityManager.Authorization |
authorize(SecurityManager.User user,
SecurityManager.Resource resource,
java.lang.String access)
Check if the given SecurityManager.User is authorized to access the named resource. |
void |
destroy()
Free resources (such as DB connections) held by this SecurityManager. |
java.lang.String |
doLogin(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest req)
Handle login. |
SecurityManager.Resource |
getResource(java.lang.String identifier)
Create a Resource object for the given resource. |
java.lang.String |
getUser(javax.servlet.http.HttpServletRequest req)
Return the uid of the authenticated user. |
SecurityManager.User |
getUserById(int id)
Load a user object identified by its numeric ID. |
java.lang.String |
getUserID(javax.servlet.http.HttpServletRequest req)
Return the numeric user id of the authenticated user. |
SecurityManager.User |
getUserObj(javax.servlet.http.HttpServletRequest req)
Return the SecurityManager.User object of the authenticated user. |
java.lang.String |
getUserRoleGroup(javax.servlet.http.HttpServletRequest req)
Get the RoleGroup for the logged in user. |
int |
getUserRoleGroupId(javax.servlet.http.HttpServletRequest req)
Get numeric RoleGroup ID. |
org.jdom.Element |
getUserStatus(javax.servlet.http.HttpServletRequest req)
Get an org.jdom.Element describing the user status. |
boolean |
hasAuth(SecurityManager.User user,
SecurityManager.Resource resource,
java.lang.String access)
Utility method to check for an authorization. |
void |
init()
Initialize SecurityManager. |
boolean |
isAnon(SecurityManager.User userobj)
Check if the given userobj is an anonymous login. |
void |
logout(javax.servlet.http.HttpServletRequest req)
Destroy any login information in the users session. |
void |
signout(SecurityManager.Authorization authorization)
Invalidate an authorization object issued by this SecurityManager. |
org.jdom.Element |
toUserStatus(javax.servlet.http.HttpServletRequest req,
int id)
Get a user status Element for the given userid. |
boolean |
validate(SecurityManager.Authorization authorization)
Check whether this Authorization object was actually created by this SecurityManager and is still valid. |
boolean |
validate(SecurityManager.User userobj)
Check whether this User object was actually created by this SecurityManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String SELECT
public static final java.lang.String INSERT
public static final java.lang.String UPDATE
public static final java.lang.String DELETE
Constructor Detail |
public SecurityManager()
Method Detail |
public void init() throws SecurityManagerException
public void destroy()
public java.lang.String doLogin(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest req)
context
- The servlet context.req
- The original request.public SecurityManager.User authenticate(java.lang.String username, java.lang.String password) throws SecurityManagerException
username
- The username.password
- The password.SecurityManagerException
- When invalid account credentials are given.public SecurityManager.User getUserById(int id) throws SecurityManagerException
public SecurityManager.Authorization authorize(SecurityManager.User user, SecurityManager.Resource resource, java.lang.String access) throws SecurityManagerException
user
- The SecurityManager.User object as returned by authenticate().resource
- The named resource.access
- One of the defined access methods.SecurityManagerException
- When access is denied.public boolean hasAuth(SecurityManager.User user, SecurityManager.Resource resource, java.lang.String access)
user
- The SecurityManager.User object as returned by authenticate().resource
- The named resource.access
- One of the defined access methods.public boolean isAnon(SecurityManager.User userobj)
public org.jdom.Element getUserStatus(javax.servlet.http.HttpServletRequest req)
req
- The servlet request object.public org.jdom.Element toUserStatus(javax.servlet.http.HttpServletRequest req, int id)
id
- The numeric user ID.public org.jdom.Element addACL(org.jdom.Element el, SecurityManager.Resource resource, SecurityManager.User user)
public boolean validate(SecurityManager.User userobj)
userobj
- The SecurityManager.User instance to validate.public boolean validate(SecurityManager.Authorization authorization)
authorization
- The SecurityManager.Authorization instance to validate.public void signout(SecurityManager.Authorization authorization)
authorization
- The SecurityManager.Authorization object.public void logout(javax.servlet.http.HttpServletRequest req)
context
- The session context.public java.lang.String getUser(javax.servlet.http.HttpServletRequest req) throws SecurityManagerException
req
- The HTTP request.public java.lang.String getUserID(javax.servlet.http.HttpServletRequest req) throws SecurityManagerException
req
- The HTTP request.public SecurityManager.User getUserObj(javax.servlet.http.HttpServletRequest req) throws SecurityManagerException
req
- The HTTP request.SecurityManagerException
- Upon failure.public java.lang.String getUserRoleGroup(javax.servlet.http.HttpServletRequest req) throws SecurityManagerException
public int getUserRoleGroupId(javax.servlet.http.HttpServletRequest req) throws SecurityManagerException
public SecurityManager.Resource getResource(java.lang.String identifier)
identifier
- The resource identifier (name).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |