public class SubjectManagerBean extends Object implements SubjectManagerLocal, SubjectManagerRemote
| Constructor and Description |
|---|
SubjectManagerBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
changePassword(org.rhq.core.domain.auth.Subject whoami,
String username,
String password)
Change the password for a user.
|
org.rhq.core.domain.auth.Subject |
checkAuthentication(String username,
String password)
Checks whether a user would successfully login with the provided credentials.
|
void |
createPrincipal(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Principal principal)
Creates a new principal (username and password) in the internal database.
|
void |
createPrincipal(org.rhq.core.domain.auth.Subject whoami,
String username,
String password)
Creates a new principal (username and password) in the internal database.
|
org.rhq.core.domain.auth.Subject |
createSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subject)
Create a a new subject.
|
org.rhq.core.domain.auth.Subject |
createSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToCreate,
String password)
Creates a new subject, including their assigned roles, as well as an associated principal with the specified
password.
|
void |
deleteSubjects(org.rhq.core.domain.auth.Subject sessionSubject,
int[] subjectIds)
Deletes the given set of users, including both the
Subject and Principal objects associated with
those users. |
void |
deleteUsers(org.rhq.core.domain.auth.Subject subject,
int[] subjectIds)
Deletes the given set of users, including both the
Subject and Principal objects associated with
those users. |
Collection<String> |
findAllUsersWithPrincipals()
Get a collection of all user names, where the collection contains the names of all users that have principals
only.
|
org.rhq.core.domain.util.PageList<org.rhq.core.domain.auth.Subject> |
findAvailableSubjectsForRole(org.rhq.core.domain.auth.Subject whoami,
Integer roleId,
Integer[] pendingSubjectIds,
org.rhq.core.domain.util.PageControl pc)
This returns a list of subjects that are available to be assigned to a given role but not yet assigned to that
role.
|
org.rhq.core.domain.util.PageList<org.rhq.core.domain.auth.Subject> |
findSubjectsByCriteria(org.rhq.core.domain.auth.Subject subject,
org.rhq.core.domain.criteria.SubjectCriteria criteria) |
org.rhq.core.domain.auth.Subject |
getOverlord()
This returns the system super user subject that can be used to authorize the caller for any other system call.
|
org.rhq.core.domain.auth.Subject |
getSubjectById(int id) |
org.rhq.core.domain.auth.Subject |
getSubjectByName(String username)
Looks up the existing subject using the given username.
|
org.rhq.core.domain.auth.Subject |
getSubjectByNameAndSessionId(String username,
int sessionId)
Adds more security in the remote api call by requiring matching username
|
org.rhq.core.domain.auth.Subject |
getSubjectBySessionId(int sessionId) |
boolean |
isUserWithPrincipal(String username)
Checks that the user exists and has a
Principal associated with it. |
boolean |
isValidSessionId(int session,
String username,
int userid)
Determines if the given session ID is valid and it is associated with the given username and user ID.
|
org.rhq.core.domain.auth.Subject |
loadUserConfiguration(Integer subjectId)
Loads in the given subject's
preferences and
roles. |
org.rhq.core.domain.auth.Subject |
login(String username,
String password)
Logs a user into the system.
|
org.rhq.core.domain.auth.Subject |
loginLocal(String username,
String password)
Logs in a user performing the authentication.
|
org.rhq.core.domain.auth.Subject |
loginUnauthenticated(String username)
Logs in a user without performing any authentication.
|
void |
logout(int sessionId) |
void |
logout(org.rhq.core.domain.auth.Subject subject)
Logs out a user.
|
org.rhq.core.domain.auth.Subject |
processSubjectForLdap(org.rhq.core.domain.auth.Subject subject,
String subjectPassword)
This method is applied to Subject instances that may require LDAP auth/authz processing.
|
void |
purgeTimedOutSessions() |
void |
scheduleSessionPurgeJob()
For internal use only - used by the StartupBean only - don't call this.
|
org.rhq.core.domain.auth.Subject |
updateSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToModify)
Updates an existing subject with new data.
|
org.rhq.core.domain.auth.Subject |
updateSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToModify,
String newPassword)
Updates an existing subject, including their assigned roles, and optionally their password.
|
public void scheduleSessionPurgeJob()
SubjectManagerLocalscheduleSessionPurgeJob in interface SubjectManagerLocalpublic void purgeTimedOutSessions()
public org.rhq.core.domain.auth.Subject loadUserConfiguration(Integer subjectId)
SubjectManagerLocalpreferences and
roles.loadUserConfiguration in interface SubjectManagerLocalsubjectId - identifies the subject whose preferences and roles are to be loadedSubjectManagerLocal.loadUserConfiguration(Integer)public org.rhq.core.domain.auth.Subject updateSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToModify)
SubjectManagerRemoteupdateSubject in interface SubjectManagerRemotewhoami - The logged in user's subject.subjectToModify - the subject whose data is to be updated (which may or may not be the same as user)subjectToModifySubjectManagerRemote.updateSubject(Subject, Subject)public org.rhq.core.domain.auth.Subject createSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToCreate,
String password)
throws SubjectException,
javax.persistence.EntityExistsException
SubjectManagerLocalcreateSubject in interface SubjectManagerLocalwhoami - the logged in user's subjectsubjectToCreate - the subject to be created (which will never be the same as subject)password - the password for the principal to be created for the new userSubjectExceptionjavax.persistence.EntityExistsExceptionpublic org.rhq.core.domain.auth.Subject updateSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToModify,
String newPassword)
SubjectManagerLocalupdateSubject in interface SubjectManagerLocalwhoami - the logged in user's subjectsubjectToModify - the subject whose data is to be updated (which may or may not be the same as subject)newPassword - if non-null, a new password to be set on the user's associated principalsubjectToModify instancepublic org.rhq.core.domain.auth.Subject getOverlord()
SubjectManagerLocalgetOverlord in interface SubjectManagerLocalSubjectManagerLocal.getOverlord()public org.rhq.core.domain.auth.Subject getSubjectByName(String username)
SubjectManagerRemotegetSubjectByName in interface SubjectManagerRemoteusername - the name of the subject to look fornull if not foundSubjectManagerRemote.getSubjectByName(String)public org.rhq.core.domain.auth.Subject createSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subject)
throws SubjectException
SubjectManagerRemotesubject. The created subject will not be
assigned to any roles; use the role manager to assign roles to a subject.createSubject in interface SubjectManagerRemotewhoami - The logged in user's subject.subject - The subject to be created.SubjectSubjectExceptionSubjectManagerRemote.createSubject(Subject, Subject)public org.rhq.core.domain.auth.Subject getSubjectById(int id)
getSubjectById in interface SubjectManagerLocalSubjectManagerLocal.getSubjectById(int)public org.rhq.core.domain.auth.Subject login(String username, String password) throws LoginException
SubjectManagerRemotelogin in interface SubjectManagerRemoteusername - The name of the user.password - The password.LoginException - if the login failed for some reasonpublic org.rhq.core.domain.auth.Subject loginLocal(String username, String password) throws LoginException
SubjectManagerLocalSubjectManagerRemote.login(String, String) method is that the latter is meant to be used only for CLI,
because if LDAP user without any role is trying to log in (and it is disabled) this one lets the user in
because of the LDAP registration form.loginLocal in interface SubjectManagerLocalusername - The user to loginLoginException - if failed to create a new session for the given userpublic org.rhq.core.domain.auth.Subject checkAuthentication(String username, String password)
SubjectManagerLocalcheckAuthentication in interface SubjectManagerLocalusername - the usernamepassword - the passwordpublic org.rhq.core.domain.auth.Subject processSubjectForLdap(org.rhq.core.domain.auth.Subject subject,
String subjectPassword)
throws LoginException
processSubjectForLdap in interface SubjectManagerLocalsubject - Authenticated subject.LoginExceptionpublic void logout(org.rhq.core.domain.auth.Subject subject)
SubjectManagerRemotelogout in interface SubjectManagerRemotesubject - The Subject to log out. The sessionId must be valid.SubjectManagerRemote.logout(Subject)public void logout(int sessionId)
logout in interface SubjectManagerLocalSubjectManagerLocal.logout(int)public void createPrincipal(org.rhq.core.domain.auth.Subject whoami,
String username,
String password)
throws SubjectException
SubjectManagerRemotecreatePrincipal in interface SubjectManagerRemotewhoami - The logged in user's subject.username - The username part of the principalpassword - The password part of the principalSubjectException - if the principal could not be addedSubjectManagerRemote.createPrincipal(Subject, String, String)public void createPrincipal(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Principal principal)
throws SubjectException
SubjectManagerLocalcreatePrincipal in interface SubjectManagerLocalwhoami - The subject of the currently logged in userprincipal - The principal to addSubjectExceptionSubjectManagerLocal.createPrincipal(Subject, Principal)public void changePassword(org.rhq.core.domain.auth.Subject whoami,
String username,
String password)
SubjectManagerRemotechangePassword in interface SubjectManagerRemotewhoami - The logged in user's subject.username - The user whose password will be changedpassword - The new password for the userSubjectManagerRemote.changePassword(Subject, String, String)public boolean isUserWithPrincipal(String username)
SubjectManagerLocalPrincipal associated with it. This means that the user both
exists and is authenticated via JDBC. An LDAP user will not have a Principal because it is authenticated
via the LDAP server, not from the database.isUserWithPrincipal in interface SubjectManagerLocalusername - the user whose existence is to be checkedtrue if the user exists and has a Principal, false otherwiseSubjectManagerLocal.isUserWithPrincipal(String)public Collection<String> findAllUsersWithPrincipals()
SubjectManagerLocalfindAllUsersWithPrincipals in interface SubjectManagerLocalSubjectManagerLocal.findAllUsersWithPrincipals()public org.rhq.core.domain.auth.Subject loginUnauthenticated(String username) throws LoginException
SubjectManagerLocalloginUnauthenticated in interface SubjectManagerLocalusername - The user to loginLoginException - if failed to create a new session for the given userSubjectManagerLocal.loginUnauthenticated(String)public void deleteUsers(org.rhq.core.domain.auth.Subject subject,
int[] subjectIds)
SubjectManagerLocalSubject and Principal objects associated with
those users.deleteUsers in interface SubjectManagerLocalsubject - the person requesting the deletionsubjectIds - identifies the subject IDs for all the users that are to be deletedSubjectManagerLocal.deleteUsers(Subject, int[])public void deleteSubjects(org.rhq.core.domain.auth.Subject sessionSubject,
int[] subjectIds)
SubjectManagerRemoteSubject and Principal objects associated with
those users.deleteSubjects in interface SubjectManagerRemotesessionSubject - The logged in user's subject.subjectIds - identifies the subject IDs for all the users that are to be deletedTODO: A wrapper method for deleteUsers, exposed in remote, both should be merged at some point.public org.rhq.core.domain.auth.Subject getSubjectBySessionId(int sessionId)
throws Exception
getSubjectBySessionId in interface SubjectManagerLocalExceptionSubjectManagerLocal.getSubjectBySessionId(int)public org.rhq.core.domain.auth.Subject getSubjectByNameAndSessionId(String username, int sessionId) throws Exception
getSubjectByNameAndSessionId in interface SubjectManagerRemoteusername - The name of the user.sessionId - The sessionId of the desired Subject.Exception - if the sessionId is not validpublic boolean isValidSessionId(int session,
String username,
int userid)
SubjectManagerLocalisValidSessionId in interface SubjectManagerLocaltrue if the session ID indentifies a valid session; false if it is invalid or
has timed outSubjectManagerLocal.isValidSessionId(int, String, int)public org.rhq.core.domain.util.PageList<org.rhq.core.domain.auth.Subject> findAvailableSubjectsForRole(org.rhq.core.domain.auth.Subject whoami,
Integer roleId,
Integer[] pendingSubjectIds,
org.rhq.core.domain.util.PageControl pc)
SubjectManagerLocalpendingSubjectIds since it is assumed the pending subjects will be assigned to the
role.findAvailableSubjectsForRole in interface SubjectManagerLocalwhoami - user attempting to make this callroleId - the role whose list of available subjects are to be returnedpendingSubjectIds - the list of subjects that are planned to be given to the rolepublic org.rhq.core.domain.util.PageList<org.rhq.core.domain.auth.Subject> findSubjectsByCriteria(org.rhq.core.domain.auth.Subject subject,
org.rhq.core.domain.criteria.SubjectCriteria criteria)
findSubjectsByCriteria in interface SubjectManagerRemoteCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.