Class DenyExecuteUpdateManager
java.lang.Object
org.kawanfw.sql.api.server.firewall.DefaultSqlFirewallManager
org.kawanfw.sql.api.server.firewall.DenyExecuteUpdateManager
- All Implemented Interfaces:
SqlFirewallManager
public class DenyExecuteUpdateManager extends DefaultSqlFirewallManager implements SqlFirewallManager
Firewall manager that denies any update of the database. The database is
thus guaranteed to be accessed in read only from client side.
- Since:
- 4.0
- Author:
- Nicolas de Pomereu
-
Constructor Summary
Constructors Constructor Description DenyExecuteUpdateManager()
-
Method Summary
Modifier and Type Method Description boolean
allowExecuteUpdate(String username, String database, Connection connection)
Allows to define if the passed username is allowed to call a statement that updates the database.void
runIfStatementRefused(String username, String database, Connection connection, String ipAddress, boolean isMetadataQuery, String sql, List<Object> parameterValues)
Logs the info usingDefaultDatabaseConfigurator.getLogger()
Logger
.Methods inherited from class org.kawanfw.sql.api.server.firewall.DefaultSqlFirewallManager
allowExecute, allowMetadataQuery, allowSqlRunAfterAnalysis, allowStatementClass
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.kawanfw.sql.api.server.firewall.SqlFirewallManager
allowExecute, allowMetadataQuery, allowSqlRunAfterAnalysis, allowStatementClass
-
Constructor Details
-
DenyExecuteUpdateManager
public DenyExecuteUpdateManager()
-
-
Method Details
-
allowExecuteUpdate
public boolean allowExecuteUpdate(String username, String database, Connection connection) throws IOException, SQLExceptionDescription copied from interface:SqlFirewallManager
Allows to define if the passed username is allowed to call a statement that updates the database.- Specified by:
allowExecuteUpdate
in interfaceSqlFirewallManager
- Overrides:
allowExecuteUpdate
in classDefaultSqlFirewallManager
- Parameters:
username
- the client username to check the rule for.database
- the database name as defined in the JDBC URL fieldconnection
- The current SQL/JDBCConnection
- Returns:
false
. (Nobody is allowed to update the database.).- Throws:
IOException
- if an IOException occursSQLException
- if a SQLException occurs
-
runIfStatementRefused
public void runIfStatementRefused(String username, String database, Connection connection, String ipAddress, boolean isMetadataQuery, String sql, List<Object> parameterValues) throws IOException, SQLExceptionLogs the info usingDefaultDatabaseConfigurator.getLogger()
Logger
.- Specified by:
runIfStatementRefused
in interfaceSqlFirewallManager
- Overrides:
runIfStatementRefused
in classDefaultSqlFirewallManager
- Parameters:
username
- the discarded client usernamedatabase
- the database name as defined in the JDBC URL fieldconnection
- The current SQL/JDBCConnection
ipAddress
- the IP address of the client userisMetadataQuery
- Says if the client request was an AceQL specific Metadata Query APIsql
- the SQL statementparameterValues
- the parameter values of a prepared statement in the natural order, empty list for a (non prepared) statement- Throws:
IOException
- if an IOException occursSQLException
- if a SQLException occurs
-