|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.enterprise.server.auth.SubjectManagerBean
public class SubjectManagerBean
Provides functionality to access and manipulate subjects and principals, mainly for authentication purposes.
| Constructor Summary | |
|---|---|
SubjectManagerBean()
|
|
| Method Summary | |
|---|---|
void |
changePassword(org.rhq.core.domain.auth.Subject whoami,
String username,
String password)
#see {@link SubjectManagerRemote#changePassword(Subject, String, String) |
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)
#see {@link SubjectManagerRemote#createPrincipal(Subject, String, String) |
org.rhq.core.domain.auth.Subject |
createSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subject)
#see {@link SubjectManagerRemote#createSubject(Subject, 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)
#see {@link SubjectManagerRemote#deleteSubjects(Subject, int[]) |
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 |
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. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SubjectManagerBean()
| Method Detail |
|---|
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 loaded
SubjectManagerLocal.loadUserConfiguration(Integer)
public org.rhq.core.domain.auth.Subject updateSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToModify)
SubjectManagerRemote
updateSubject in interface SubjectManagerLocalupdateSubject 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)
subjectToModifySubjectManagerLocal.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
SubjectManagerLocal
createSubject 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 user
SubjectException
javax.persistence.EntityExistsException
public org.rhq.core.domain.auth.Subject updateSubject(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Subject subjectToModify,
String newPassword)
SubjectManagerLocal
updateSubject 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 principal
subjectToModify instancepublic org.rhq.core.domain.auth.Subject getOverlord()
SubjectManagerLocal
getOverlord in interface SubjectManagerLocalSubjectManagerLocal.getOverlord()public org.rhq.core.domain.auth.Subject getSubjectByName(String username)
SubjectManagerRemote
getSubjectByName in interface SubjectManagerLocalgetSubjectByName in interface SubjectManagerRemoteusername - the name of the subject to look for
null 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
SubjectManagerLocal
createSubject in interface SubjectManagerLocalcreateSubject in interface SubjectManagerRemotewhoami - The logged in user's subject.subject - The subject to be created.
Subject
SubjectExceptionSubjectManagerLocal.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
SubjectManagerRemote
login in interface SubjectManagerLocallogin in interface SubjectManagerRemoteusername - The name of the user.password - The password.
LoginException - if the login failed for some reasonSubjectManagerLocal.login(String, String)
public org.rhq.core.domain.auth.Subject checkAuthentication(String username,
String password)
SubjectManagerLocal
checkAuthentication in interface SubjectManagerLocalusername - the usernamepassword - the password
public 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)
SubjectManagerRemote
logout in interface SubjectManagerLocallogout 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
SubjectManagerLocal
createPrincipal in interface SubjectManagerLocalcreatePrincipal in interface SubjectManagerRemotewhoami - The logged in user's subject.username - The username part of the principalpassword - The password part ofthe principal
SubjectExceptionSubjectManagerLocal.createPrincipal(Subject, String, String)
public void createPrincipal(org.rhq.core.domain.auth.Subject whoami,
org.rhq.core.domain.auth.Principal principal)
throws SubjectException
SubjectManagerLocal
createPrincipal in interface SubjectManagerLocalwhoami - The subject of the currently logged in userprincipal - The principal to add
SubjectExceptionSubjectManagerLocal.createPrincipal(Subject, Principal)
public void changePassword(org.rhq.core.domain.auth.Subject whoami,
String username,
String password)
SubjectManagerLocal
changePassword in interface SubjectManagerLocalchangePassword in interface SubjectManagerRemotewhoami - The logged in user's subject.username - The user whose password will be changedpassword - The new password for the userSubjectManagerLocal.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 checked
true if the user exists and has a Principal, false otherwiseSubjectManagerLocal.isUserWithPrincipal(String)public Collection<String> findAllUsersWithPrincipals()
SubjectManagerLocal
findAllUsersWithPrincipals in interface SubjectManagerLocalSubjectManagerLocal.findAllUsersWithPrincipals()
public org.rhq.core.domain.auth.Subject loginUnauthenticated(String username)
throws LoginException
SubjectManagerLocal
loginUnauthenticated in interface SubjectManagerLocalusername - The user to login
LoginException - 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)
SubjectManagerLocal
deleteSubjects in interface SubjectManagerLocaldeleteSubjects 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 SubjectManagerLocalgetSubjectByNameAndSessionId in interface SubjectManagerRemoteusername - The name of the user.sessionId - The sessionId of the desired Subject.
Exception - if the sessionId is not validSubjectManagerRemote#getSubjectByNameAndSessionId(String, int)}
public boolean isValidSessionId(int session,
String username,
int userid)
SubjectManagerLocal
isValidSessionId 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 role
public 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 SubjectManagerLocalfindSubjectsByCriteria in interface SubjectManagerRemoteSubjectManagerRemote.findSubjectsByCriteria(Subject, SubjectCriteria)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||