Awake SQL v1.2.1

org.awakefw.sql.api.server
Interface AwakeSqlConfigurator

All Known Implementing Classes:
DefaultAwakeSqlConfigurator

public interface AwakeSqlConfigurator

Interface that defines the User Security Configuration for the Awake SQL Framework on the server side.

The implemented methods will be called by the Awake SQL Server programs when a client program, referred by a user username, asks for a JDBC operation from the Client side.

A concrete implementation should be developed on the server side in order to:

Note that the helper class StatementAnalyser allows to do some simple tests on the SQL statement string representation.

Note that Awake SQL comes with a Default AwakeSqlConfigurator implementation that is *not* secured and should be extended: DefaultAwakeSqlConfigurator.

Since:
1.0

Method Summary
 boolean allowExecute(String username, Connection connection)
          Allows to define if the passed username is allowed to call a Statement.execute(String) or PreparedStatement.execute()
 boolean allowExecuteUpdate(String username, Connection connection)
          Allows to define if the passed username is allowed to call a Statement.executeUpdate(String) or PreparedStatement.executeUpdate()
 boolean allowGetMetaData(String username, Connection connection)
          Allows to define if the passed username is allowed to query the database catalog through Connection.getMetaData().
 boolean allowResultSetGetMetaData(String username, Connection connection)
          Allows to define if the passed username is allowed to query the ResultSet properties through ResultSet.getMetaData() .
 boolean allowStatementAfterAnalysis(String username, Connection connection, String sql, List<Object> parameterValues)
          Allows, for the passed client username, to analyze the string representation of the SQL statement that is received on the server.
 boolean allowStatementClass(String username, Connection connection)
          Allows to define if the passed username is allowed to create and use a Statement instance that is not a PreparedStatement
 void runIfStatementRefused(String username, Connection connection, String ipAddress, String sql, List<Object> parameterValues)
          Allows to implement specific a Java rule immediately after a SQL statement has been refused because one of the AwakeSqlConfigurator.allowXxx method returned false.
 

Method Detail

allowExecute

boolean allowExecute(String username,
                     Connection connection)
                     throws IOException,
                            SQLException
Allows to define if the passed username is allowed to call a Statement.execute(String) or PreparedStatement.execute()

Parameters:
username - the client username to check the rule for.
connection - The current SQL/JDBC Connection
Returns:
true if the user has the right to call a raw execute

Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs
Since:
1.1

allowExecuteUpdate

boolean allowExecuteUpdate(String username,
                           Connection connection)
                           throws IOException,
                                  SQLException
Allows to define if the passed username is allowed to call a Statement.executeUpdate(String) or PreparedStatement.executeUpdate()

Parameters:
username - the client username to check the rule for.
connection - The current SQL/JDBC Connection
Returns:
true if the user has the right to call a raw execute

Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs
Since:
1.1

allowGetMetaData

boolean allowGetMetaData(String username,
                         Connection connection)
                         throws IOException,
                                SQLException
Allows to define if the passed username is allowed to query the database catalog through Connection.getMetaData().

Parameters:
username - the client username to check the rule for.
connection - The current SQL/JDBC Connection
Returns:
true if the user has the right to query the Database catalog.

Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

allowResultSetGetMetaData

boolean allowResultSetGetMetaData(String username,
                                  Connection connection)
                                  throws IOException,
                                         SQLException
Allows to define if the passed username is allowed to query the ResultSet properties through ResultSet.getMetaData() .

Parameters:
username - the client username to check the rule for.
connection - The current SQL/JDBC Connection
Returns:
true if the user has the right to query ResultSet properties

Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

allowStatementAfterAnalysis

boolean allowStatementAfterAnalysis(String username,
                                    Connection connection,
                                    String sql,
                                    List<Object> parameterValues)
                                    throws IOException,
                                           SQLException
Allows, for the passed client username, to analyze the string representation of the SQL statement that is received on the server.
If the analysis defined by the method returns false, the SQL statement won't be executed.

Parameters:
username - the client username to check the rule for.
connection - The current SQL/JDBC Connection
sql - the SQL statement
parameterValues - the parameter values of a prepared statement in the natural order, empty list for a (non prepared) statement
Returns:
true if the analyzed statement or prepared statement is validated.

Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

allowStatementClass

boolean allowStatementClass(String username,
                            Connection connection)
                            throws IOException,
                                   SQLException
Allows to define if the passed username is allowed to create and use a Statement instance that is not a PreparedStatement

Parameters:
username - the client username to check the rule for.
connection - The current SQL/JDBC Connection
Returns:
true if the user has the right to call a raw execute

Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs
Since:
1.1

runIfStatementRefused

void runIfStatementRefused(String username,
                           Connection connection,
                           String ipAddress,
                           String sql,
                           List<Object> parameterValues)
                           throws IOException,
                                  SQLException
Allows to implement specific a Java rule immediately after a SQL statement has been refused because one of the AwakeSqlConfigurator.allowXxx method returned false.

Examples:

Parameters:
username - the discarded client username
connection - The current SQL/JDBC Connection
ipAddress - the IP address of the client user
sql - the SQL statement
parameterValues - the parameter values of a prepared statement in the natural order, empty list for a (non prepared) statement
Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

Awake SQL v1.2.1

Awake SQL - Virtual JDBC Driver over HTTP for Android, Swing and JavaFX
Android & Desktop Edition allow easy access to majors remote SQL databases with regular JDBC calls:
DB2 - H2 - HSQLDB (HyperSQL) - Informix - Ingres - MySQL - Oracle - PostgreSQL - SQL Server - Sybase - Teradata
Copyright © 2012 Kawan Softwares SAS