Under Jaffa, the JDBCSecurityPlugin (under source\java\org\jaffa\security ) class implements the
IJDBCSecurityPlugin interface.
org.jaffa.persistence.engines.jdbcengine.security.IJDBCSecurityPlugin |
public interface IJdbcSecurityPlugin {
public void newConnection(Connection connection) throws SQLException;
public void freeConnection(Connection connection) throws SQLException;
}
|
This interface allows functions to be implemented on the database connection just as a connection
is being assigned from the connection pool to a UOW object. A second method is also called prior to placing the
connection back in the pool, once the UOW has finished with it.
We there for want to implement a class that when a connection is acquired, we set the context of
that connection based on the security context associated to the user executing the function.
The newConnection(...) method gets the Security context and then gets the principal
to retrieve the user logged in the application.
Then it gets the list of roles assigned to the User and passes these information to the stored procedure to switch the context.
The procedure called is 'set_userid(...)' in the jaffa_sec package.
To tell the JDBC Persistence Engine to use the security Plug in you must open
source\java\org\jaffa\config\framework.properties.
The property framework.persistence.jdbcengine.security.plugin is set to the class which implements the IJDBCSecurityPlugin.
To use the plugin supplied by Jaffa, set this property to org.jaffa.security.JDBCSecurityPlugin
framework.properties |
# The class that implements the IJdbcSecurityPlugin interface.
# It is invoked after acquiring and before freeing up a Connection object
# Do no specify any value, if this functionality is not desired.
framework.persistence.jdbcengine.security.plugin=org.jaffa.security.JDBCSecurityPlugin
|
|