|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.moremotion.security.SecurityContext
public class SecurityContext
Represents a Security Context that is the gateway for user related security operations.
The object of this class is created by the SecurityManager.getSecurityContext(org.moremotion.servlet.MoreMotionRequest, java.lang.String, java.lang.String, java.lang.String)
method.
The operations that update the security information are reflected to the persistency through the security broker interface that is
defined by the SecurityBrokerConfig.
Method Summary | |
---|---|
boolean |
authenticateUser(User user,
java.lang.String password)
Authenticates the given user ubject and the specified password (plain) and returns true
if user is found and its password mathes. |
void |
deleteCheckPoint(java.lang.String checkPointName)
Deletes an check point. |
void |
deleteRole(java.lang.String roleName)
Deletes a role by its name. |
void |
deleteUser(java.lang.String userName)
Deletes the given user. |
java.lang.String |
encryptPassword(java.lang.String password)
Encryptes the specified plain password. |
int |
flaTries(java.lang.String userName,
long suspendPeriod)
|
void |
forcedLogout()
|
int |
getActiveUserCount(java.lang.String subDomainName)
Returns the number of the active users |
java.util.ArrayList |
getActiveUsers(java.lang.String subDomainName,
int from,
int amount)
Returns the specified portion of the active users |
java.lang.String |
getAdminRoleName()
Returns the name of the role name of the system administrator. |
CheckPoint |
getCheckPoint(java.lang.String checkPointName)
Gets an CheckPoint by its name. |
CheckPoint[] |
getCheckPoints()
Lists all check points. |
User |
getCurrentUser()
Returns the user object that currently logged-in. |
User |
getCurrentUser(boolean refresh)
|
RememberUser |
getRememberUser()
|
MoreMotionRequest |
getRequest()
Returns the request associated with this context. |
Role |
getRole(java.lang.String roleName)
Finds a role by its name. |
Role[] |
getRoles()
Lists all roles. |
java.lang.String |
getRootUserName()
Returns the name of the root user. |
SecurityBrokerConfig |
getSecurityBrokerDefinition()
Returns the security broker definition associated with this context. |
java.lang.String |
getSecurityDomain()
Returns the name of the security domain associated with this context. |
SignedUser |
getSignerUser()
|
java.lang.String |
getSubdomain()
Returns the subdomain associated with this context |
User |
getUser(java.lang.String username)
Returns a User object by its username. |
User |
getUserByEmail(java.lang.String email)
Returns a User object by its email. |
User[] |
getUsers()
Returns a list of all the users. |
User[] |
getUsers(int from,
int amount,
MutableInt nou)
Returns a sublist of the users. |
boolean |
hasAuthority(User user,
java.lang.String checkPoint)
Returns true if the given user object has the authority for the specified checkpoint. |
void |
login(User user)
Logs in the given user. |
void |
login(User user,
boolean multipleLoginAllowed)
Logs in the given user. |
void |
logout()
Logs out the current user |
void |
logout(java.lang.String userName)
Logs out the specified user. |
User |
newUser(java.lang.String name,
java.lang.String password,
java.lang.String email,
java.lang.String fullname,
boolean accDsbld)
Creates a new user in this context. |
void |
prepareBroker()
|
int |
registerFailedLoginAttempt(java.lang.String userName,
long suspendPeriod)
|
void |
saveCheckPoint(CheckPoint checkPoint)
Saves a check point. |
void |
saveRole(Role role)
Saves a role. |
void |
saveUser(User user)
Saves given user. |
User[] |
searchUsers(java.lang.String searchCriteria,
int from,
int amount,
MutableInt nou)
Returns a sublist of users that match with search criteria |
void |
setSubdomain(java.lang.String subdomain)
Sets the subdomain of this context |
void |
setVar(java.lang.String name,
java.lang.String value)
Sets a security broker variable. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void prepareBroker()
public MoreMotionRequest getRequest()
public void setSubdomain(java.lang.String subdomain)
public java.lang.String getSubdomain()
public java.lang.String getSecurityDomain()
public RememberUser getRememberUser()
public java.util.ArrayList getActiveUsers(java.lang.String subDomainName, int from, int amount)
subDomainName
- public int getActiveUserCount(java.lang.String subDomainName)
public SecurityBrokerConfig getSecurityBrokerDefinition()
public User newUser(java.lang.String name, java.lang.String password, java.lang.String email, java.lang.String fullname, boolean accDsbld)
name
- The user namepassword
- The plain passwordemail
- The email of the userfullname
- The full name of the useraccDsbld
- true
to create the new user as disabled
public boolean authenticateUser(User user, java.lang.String password)
true
if user is found and its password mathes.
public boolean hasAuthority(User user, java.lang.String checkPoint)
true
if the given user object has the authority for the specified checkpoint.
public java.lang.String getRootUserName()
public java.lang.String getAdminRoleName()
public User getCurrentUser(boolean refresh)
public User getCurrentUser()
null
if no user is logged-in.
public SignedUser getSignerUser()
public void login(User user) throws SecurityDomainException
user
- The user object to login
SecurityDomainException
- if login failspublic void login(User user, boolean multipleLoginAllowed) throws SecurityDomainException
user
- The user object to loginmultipleLoginAllowed
- If false
and is the user is already logged-in it fires MultipleLoginDisallowedException.
SecurityDomainException
- if login fails
MultipleLoginDisallowedException
- if the user is already logged-in.public int registerFailedLoginAttempt(java.lang.String userName, long suspendPeriod)
public int flaTries(java.lang.String userName, long suspendPeriod)
public void logout()
public void logout(java.lang.String userName)
public void forcedLogout()
public java.lang.String encryptPassword(java.lang.String password)
public User getUser(java.lang.String username) throws MissingSecurityEntityException
username
- User name.
MissingSecurityEntityException
- If user cannot be found.public User getUserByEmail(java.lang.String email) throws MissingSecurityEntityException
email
- Email of user.
MissingSecurityEntityException
- If user cannot be found.public User[] getUsers() throws MissingSecurityEntityException
MissingSecurityEntityException
public User[] getUsers(int from, int amount, MutableInt nou) throws MissingSecurityEntityException
from
- the start index.amount
- the number of the users to return.nou
- A return value: Total number of users found
MissingSecurityEntityException
public User[] searchUsers(java.lang.String searchCriteria, int from, int amount, MutableInt nou) throws MissingSecurityEntityException
searchCriteria
- the string that contains the search criteriafrom
- the start index.amount
- the number of the users to return.nou
- A return value: Total number of users found
MissingSecurityEntityException
public void saveUser(User user) throws SaveSecurityEntityException
user
- User object
SaveSecurityEntityException
- If user cannot be saved.public void deleteUser(java.lang.String userName) throws DeleteSecurityEntityException
userName
- name of the user
DeleteSecurityEntityException
- If user cannot be deleted.public Role getRole(java.lang.String roleName) throws MissingSecurityEntityException
roleName
- Role name.
MissingSecurityEntityException
- If role cannot be found.public Role[] getRoles()
public void saveRole(Role role) throws SaveSecurityEntityException
role
- Role object.
SaveSecurityEntityException
- If role cannot be saved.public void deleteRole(java.lang.String roleName) throws DeleteSecurityEntityException
roleName
- Role name.
DeleteSecurityEntityException
- If role cannot be deleted.public CheckPoint[] getCheckPoints()
public CheckPoint getCheckPoint(java.lang.String checkPointName) throws MissingSecurityEntityException
checkPointName
- Check point name.
MissingSecurityEntityException
- If check point cannot be found.public void saveCheckPoint(CheckPoint checkPoint) throws SaveSecurityEntityException
checkPoint
- CheckPoint object.
SaveSecurityEntityException
- If check point cannot be saved.public void deleteCheckPoint(java.lang.String checkPointName) throws DeleteSecurityEntityException
checkPointName
- Check point name.
DeleteSecurityEntityException
- If check point cannot be deleted.public void setVar(java.lang.String name, java.lang.String value) throws SaveSecurityEntityException
name
- variable name.value
- variavle value.
SaveSecurityEntityException
- If property value cannot be set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |