org.moremotion.security.broker
Interface SecurityBroker


public interface SecurityBroker

Defines an Interface for security brokers. With this interface MoreMotion's security system is isolated from the persistency (where the security information stored).

Version:
$Id: SecurityBroker.java 51 2008-03-10 11:46:54Z erkan $

Method Summary
 void authenticateUser(User user, java.lang.String password)
          Authenticates a user with password (plain)
 void deleteCheckPoint(BrokerCommunicationContext bcc, java.lang.String checkPointName)
          Deletes a check point.
 void deleteRole(BrokerCommunicationContext bcc, java.lang.String roleName)
          Deletes a role by its Name.
 void deleteUser(BrokerCommunicationContext bcc, java.lang.String userName)
          Deletes a user.
 java.lang.String encryptPassword(java.lang.String password)
          Encryptes the given plain password.
 CheckPoint getCheckPoint(BrokerCommunicationContext bcc, java.lang.String checkPointName)
          Finds a check point by its name.
 CheckPoint[] getCheckPoints(BrokerCommunicationContext bcc)
          Returns a lists of all checkpoints.
 Role getRole(BrokerCommunicationContext bcc, java.lang.String roleName)
          Returns a role by its name.
 Role[] getRoles(BrokerCommunicationContext bcc)
          Returns a list all of roles.
 User getUser(BrokerCommunicationContext bcc, java.lang.String userName)
          Gets a user by its name.
 User getUserByEmail(BrokerCommunicationContext bcc, java.lang.String email)
          Gets a user by its Email address.
 User[] getUsers(BrokerCommunicationContext bcc)
          Returns list of all users.
 User[] getUsers(BrokerCommunicationContext bcc, int from, int amount, MutableInt noi)
          Returns a sublist of the users.
 java.lang.Object init(MoreMotionRequest request, java.lang.String connectionDatasource, java.util.Map brokerParams)
          Initialises the broker.
 BrokerCommunicationContext prepare(MoreMotionRequest request, java.lang.Object initializedObject)
          Prepares the broker for the successive calls.
 void saveCheckPoint(BrokerCommunicationContext bcc, CheckPoint checkPoint)
          Saves a check point.
 void saveRole(BrokerCommunicationContext bcc, Role role)
          Saves a role.
 void saveUser(BrokerCommunicationContext bcc, User user)
          Saves a user.
 User[] searchUsers(BrokerCommunicationContext bcc, java.lang.String searchCriteria, int from, int amount, MutableInt noi)
          Returns list of that users that match with search criteria
 

Method Detail

init

java.lang.Object init(MoreMotionRequest request,
                      java.lang.String connectionDatasource,
                      java.util.Map brokerParams)
                      throws SecurityBrokerException
Initialises the broker. This method is called by the security manager right after the class that implements this interface is loaded.

Parameters:
request - MoreMotionRequest object
connectionDatasource - The name of the MoreMotion datasource that is defined in datasources dialog of mmDesigner.
brokerParams - The Map object that contains the broker parameters
Returns:
An object created by the broker. This object will be kept by the security manager and passed to the broker again by the prepare() call.
Throws:
SecurityBrokerException - if initialisation fails.

prepare

BrokerCommunicationContext prepare(MoreMotionRequest request,
                                   java.lang.Object initializedObject)
                                   throws SecurityBrokerException
Prepares the broker for the successive calls. This method is called once for each Servlet Request to prepare the broker for the successive calls until the request is responded. For relational database brokers this is a good time to get a database connection.

Parameters:
request - MoreMotionRequest object
initializedObject - The object created by the init() method.
Returns:
An object created by this method, for releational database brokers generally this object is a connection object or contains an connection object.
Throws:
SecurityBrokerException - if preparation fails.

getUser

User getUser(BrokerCommunicationContext bcc,
             java.lang.String userName)
             throws MissingSecurityEntityException
Gets a user by its name.

Parameters:
bcc - BrokerCommunication Object
userName - User name.
Returns:
User object.
Throws:
MissingSecurityEntityException - If user cannot be found.

getUserByEmail

User getUserByEmail(BrokerCommunicationContext bcc,
                    java.lang.String email)
                    throws MissingSecurityEntityException
Gets a user by its Email address.

Parameters:
bcc - BrokerCommunication Object
email - User E-mail.
Returns:
User object.
Throws:
MissingSecurityEntityException - If no user is found with given email.

deleteUser

void deleteUser(BrokerCommunicationContext bcc,
                java.lang.String userName)
                throws DeleteSecurityEntityException
Deletes a user.

Parameters:
bcc - BrokerCommunication Object
userName - User name.
Throws:
DeleteSecurityEntityException - If deletion fails.

saveUser

void saveUser(BrokerCommunicationContext bcc,
              User user)
              throws SaveSecurityEntityException
Saves a user.

Parameters:
bcc - BrokerCommunication Object
user - User object.
Throws:
SaveSecurityEntityException - If user cannot be saved.

getUsers

User[] getUsers(BrokerCommunicationContext bcc)
                throws MissingSecurityEntityException
Returns list of all users.

Parameters:
bcc - BrokerCommunication Object
Returns:
User objects array.
Throws:
MissingSecurityEntityException

getUsers

User[] getUsers(BrokerCommunicationContext bcc,
                int from,
                int amount,
                MutableInt noi)
                throws MissingSecurityEntityException
Returns a sublist of the users.

Parameters:
bcc - BrokerCommunication Object
from - the start index.
amount - the number of the users to return.
Returns:
User objects array.
Throws:
MissingSecurityEntityException

searchUsers

User[] searchUsers(BrokerCommunicationContext bcc,
                   java.lang.String searchCriteria,
                   int from,
                   int amount,
                   MutableInt noi)
                   throws MissingSecurityEntityException
Returns list of that users that match with search criteria

Parameters:
bcc - BrokerCommunication Object
searchCriteria - the string that contains the search criteria
from - the start index.
amount - the number of the users to return.
Returns:
User objects array.
Throws:
MissingSecurityEntityException

authenticateUser

void authenticateUser(User user,
                      java.lang.String password)
                      throws AuthenticationException
Authenticates a user with password (plain)

Parameters:
user - User object.
password - String.
Throws:
Authenticate - if user is not authenticated.
AuthenticationException

encryptPassword

java.lang.String encryptPassword(java.lang.String password)
Encryptes the given plain password. The Broker should implement password encryption here

Parameters:
password - Plain Password String.

getRole

Role getRole(BrokerCommunicationContext bcc,
             java.lang.String roleName)
             throws MissingSecurityEntityException
Returns a role by its name.

Parameters:
bcc - BrokerCommunication Object
roleName - Role name.
Returns:
Role object.
Throws:
MissingSecurityEntityException - If role cannot be found.

deleteRole

void deleteRole(BrokerCommunicationContext bcc,
                java.lang.String roleName)
                throws DeleteSecurityEntityException
Deletes a role by its Name.

Parameters:
bcc - BrokerCommunication Object
roleName - Role Name.
Throws:
DeleteSecurityEntityException - If role cannot be found.

getRoles

Role[] getRoles(BrokerCommunicationContext bcc)
Returns a list all of roles.

Parameters:
bcc - BrokerCommunication Object
Returns:
Role objects array.

saveRole

void saveRole(BrokerCommunicationContext bcc,
              Role role)
              throws SaveSecurityEntityException
Saves a role.

Parameters:
bcc - BrokerCommunication Object
role - Role object.
Throws:
SaveSecurityEntityException - If role cannot be saved.

getCheckPoint

CheckPoint getCheckPoint(BrokerCommunicationContext bcc,
                         java.lang.String checkPointName)
                         throws MissingSecurityEntityException
Finds a check point by its name.

Parameters:
bcc - BrokerCommunication Object
checkPointName - Check point name.
Returns:
CheckPoint object.
Throws:
MissingSecurityEntityException - If check point cannot be found.

getCheckPoints

CheckPoint[] getCheckPoints(BrokerCommunicationContext bcc)
Returns a lists of all checkpoints.

Parameters:
bcc - BrokerCommunication Object
Returns:
CheckPoint objects array.

deleteCheckPoint

void deleteCheckPoint(BrokerCommunicationContext bcc,
                      java.lang.String checkPointName)
                      throws DeleteSecurityEntityException
Deletes a check point.

Parameters:
bcc - BrokerCommunication Object
checkPointName - Check point name.
Throws:
DeleteSecurityEntityException - If deletion fails.

saveCheckPoint

void saveCheckPoint(BrokerCommunicationContext bcc,
                    CheckPoint checkPoint)
                    throws SaveSecurityEntityException
Saves a check point.

Parameters:
bcc - BrokerCommunication Object
checkPoint - CheckPoint object.
Throws:
SaveSecurityEntityException - If check point cannot be saved.


Copyright © 2002-2008 MOR YAZILIM. All Rights Reserved.