com.evermind.security
Interface RoleManager


public interface RoleManager

Interface used to manage and add/remove principals from roles. Applications retrieve the RoleManager with the following line: RoleManager manager = (RoleManager)new InitialContext().lookup("java:comp/RoleManager");


Method Summary
 void addToRole(java.security.Principal principal, java.lang.String role)
          Adds a principal to the specified role, in practice this usually implies adding the principal to the legacy groups the role encompasses.
 java.security.Principal createPrincipal(java.lang.String principalName, java.lang.String password)
          Creates a new Principal with the specified username and password.
 java.security.Principal createPrincipal(java.lang.String principalName, java.lang.String password, java.lang.String role)
          Creates a new Principal belonging to the specified role.
 java.security.Principal createPrincipal(java.lang.String principalName, java.lang.String password, java.security.cert.X509Certificate certificate)
          Creates a new Principal and ties the certificate to the principal.
 java.security.Principal getPrincipal(java.lang.String name)
          Gets the principal by the specified name, shortcut to the UserManager method.
 boolean isPrincipalInRole(java.security.Principal user, java.lang.String role)
          Checks if a principal is a part of a role.
 void login(java.lang.String username, java.lang.String password)
          Logs the specified user in (if the password matches).
 void remove(java.security.Principal principal)
          Removes/deletes the Principal, shortcut to the UserManager method.
 void removeFromRole(java.security.Principal principal, java.lang.String role)
          Removes the principal from the specified role.
 void store()
          Stores the updates to persistent storage.
 

Method Detail

addToRole


public void addToRole(java.security.Principal principal,
                      java.lang.String role)
Adds a principal to the specified role, in practice this usually implies adding the principal to the legacy groups the role encompasses.

removeFromRole


public void removeFromRole(java.security.Principal principal,
                           java.lang.String role)
Removes the principal from the specified role.

getPrincipal


public java.security.Principal getPrincipal(java.lang.String name)
Gets the principal by the specified name, shortcut to the UserManager method.

createPrincipal


public java.security.Principal createPrincipal(java.lang.String principalName,
                                               java.lang.String password)
                                        throws UserAlreadyExistsException,
                                               java.lang.InstantiationException
Creates a new Principal with the specified username and password.

createPrincipal


public java.security.Principal createPrincipal(java.lang.String principalName,
                                               java.lang.String password,
                                               java.lang.String role)
                                        throws UserAlreadyExistsException,
                                               java.lang.InstantiationException
Creates a new Principal belonging to the specified role.

createPrincipal


public java.security.Principal createPrincipal(java.lang.String principalName,
                                               java.lang.String password,
                                               java.security.cert.X509Certificate certificate)
                                        throws UserAlreadyExistsException,
                                               java.lang.InstantiationException
Creates a new Principal and ties the certificate to the principal.

remove


public void remove(java.security.Principal principal)
Removes/deletes the Principal, shortcut to the UserManager method.

store


public void store()
           throws java.io.IOException
Stores the updates to persistent storage.

isPrincipalInRole


public boolean isPrincipalInRole(java.security.Principal user,
                                 java.lang.String role)
Checks if a principal is a part of a role.

login


public void login(java.lang.String username,
                  java.lang.String password)
           throws java.lang.SecurityException
Logs the specified user in (if the password matches).
Throws:
java.lang.SecurityException - if the username/password doesnt match.