org.rhq.enterprise.server.auth
Interface SubjectManagerRemote

All Known Subinterfaces:
WebservicesRemote

public interface SubjectManagerRemote


Method Summary
 void changePassword(Subject subject, String username, String password)
          Change the password for a user.
 void createPrincipal(Subject subject, String username, String password)
          Creates a new principal (username and password) in the internal database.
 Subject createSubject(Subject subject, Subject subjectToCreate)
          Create a a new subject.
 void deleteSubjects(Subject subject, int[] subjectIds)
          Deletes the given set of users, including both the Subject and Principal objects associated with those users.
 PageList<Subject> findSubjectsByCriteria(Subject subject, SubjectCriteria criteria)
           
 Subject getSubjectByName(String username)
          Deprecated. This method should be avoided as it may be removed in a future release. Given that multiple sessions may exist for a single user the result of this call is non-deterministic.
 Subject getSubjectByNameAndSessionId(String username, int sessionId)
          Looks up the Subject for a current RHQ session by username and sessionId.
 Subject login(String username, String password)
          Logs a user into the system.
 void logout(Subject subject)
          Logs out a user.
 Subject updateSubject(Subject subject, Subject subjectToModify)
          Updates an existing subject with new data.
 

Method Detail

changePassword

void changePassword(Subject subject,
                    String username,
                    String password)
Change the password for a user.

Parameters:
subject - The logged in user's subject.
username - The user whose password will be changed
password - The new password for the user

createPrincipal

void createPrincipal(Subject subject,
                     String username,
                     String password)
                     throws org.rhq.enterprise.server.auth.SubjectException
Creates a new principal (username and password) in the internal database. The password will be encoded before being stored.

Parameters:
subject - The logged in user's subject.
username - The username part of the principal
password - The password part ofthe principal
Throws:
Exception - if the principal could not be added
org.rhq.enterprise.server.auth.SubjectException

createSubject

Subject createSubject(Subject subject,
                      Subject subjectToCreate)
                      throws org.rhq.enterprise.server.auth.SubjectException
Create a a new subject. This ignores the roles in subject. The created subject will not be assigned to any roles; use the role manager to assign roles to a subject.

Parameters:
subject - The logged in user's subject.
subjectToCreate - The subject to be created.
Returns:
the newly persisted Subject
Throws:
org.rhq.enterprise.server.auth.SubjectException

deleteSubjects

void deleteSubjects(Subject subject,
                    int[] subjectIds)
Deletes the given set of users, including both the Subject and Principal objects associated with those users.

Parameters:
subject - The logged in user's subject.
subjectIds - identifies the subject IDs for all the users that are to be deleted
Throws:
Exception - if failed to delete one or more users

getSubjectByName

Subject getSubjectByName(String username)
Deprecated. This method should be avoided as it may be removed in a future release. Given that multiple sessions may exist for a single user the result of this call is non-deterministic.

Looks up the existing subject using the given username.

Parameters:
username - the name of the subject to look for
Returns:
the subject that was found or null if not found

getSubjectByNameAndSessionId

Subject getSubjectByNameAndSessionId(String username,
                                     int sessionId)
                                     throws Exception
Looks up the Subject for a current RHQ session by username and sessionId.

Parameters:
username - The name of the user.
sessionId - The sessionId of the desired Subject.
Returns:
The Subject that was found
Throws:
Exception - if the sessionId is not valid

login

Subject login(String username,
              String password)
              throws org.rhq.enterprise.server.exception.LoginException
Logs a user into the system. This will authenticate the given user with the given password. If the user was already logged in, the current session will be used but the password will still need to be authenticated.

Parameters:
username - The name of the user.
password - The password.
Returns:
The subject of the authenticated user.
Throws:
org.rhq.enterprise.server.exception.LoginException - if the login failed for some reason

logout

void logout(Subject subject)
Logs out a user.

Parameters:
subject - The Subject to log out. The sessionId must be valid.

updateSubject

Subject updateSubject(Subject subject,
                      Subject subjectToModify)
Updates an existing subject with new data. This does not cascade any changes to the roles but it will save the subject's configuration.

Parameters:
subject - 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)
Returns:
the merged subject, which may or may not be the same instance of subjectToModify

findSubjectsByCriteria

PageList<Subject> findSubjectsByCriteria(Subject subject,
                                         SubjectCriteria criteria)


Copyright © 2005-2011 Red Hat, Inc.. All Rights Reserved.