Awake SQL v1.2.1

org.awakefw.commons.api.server
Interface AwakeCommonsConfigurator

All Known Implementing Classes:
DefaultAwakeCommonsConfigurator

public interface AwakeCommonsConfigurator

Interface that defines the common User Configuration for the Awake File and Awake SQL Frameworks.

All the implemented methods will be called by the Awake Server programs when a client program asks for access to the database from the remote Client side.

A concrete implementation should be developed on the Server side by a Awake users in order to:

Please note that Awake comes with a Default AwakeCommonsConfigurator implementation that may be extended: DefaultAwakeCommonsConfigurator.

Since:
1.0
See Also:
DefaultAwakeCommonsConfigurator

Method Summary
 String addSecretForAuthToken()
          Allows to define a secret value that will enforce the security of the authentication defined in computeAuthToken.
 String computeAuthToken(String username)
          Allows to compute a secret value that will secure the authentication.
 boolean forceSecureHttp()
          Allows to define if the host url must be accessed in secured httpS.
 List<String> getBannedIPs()
          Allows to define the list of banned IP addresses.
 Set<String> getBannedUsernames()
          Allows to define the set of banned usernames.
 Connection getConnection()
           Attempts to establish a connection with an underlying data source.
 char[] getEncryptionPassword()
          Allows to define the password that is used to encrypt from the Client all the request parameters values for security reason (obfuscation and transport encryption).
 Logger getLogger()
          Returns the Logger that will be used by Awake File or Awake SQL logging: All Exceptions thrown by server side will be logged.
 boolean login(String username, char[] password)
          Allows to authenticate the remote (username, password) couple send by the client side and to give access to the Awaker Server.
 

Method Detail

addSecretForAuthToken

String addSecretForAuthToken()
                             throws IOException,
                                    SQLException
Allows to define a secret value that will enforce the security of the authentication defined in computeAuthToken.

Returns:
the secret value to enforce the secure the authentication defined in computeAuthToken.
Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs
See Also:
computeAuthToken(java.lang.String)

computeAuthToken

String computeAuthToken(String username)
                        throws Exception
Allows to compute a secret value that will secure the authentication.

After login() succeeds, the method uses username and the value returned by addSecretForAuthToken() to build and Authentication Token that will be use by each following client call in order to authenticate the calls.

The Authentication Token default value built by the default implementation in DefaultAwakeCommonsConfigurator.computeAuthToken(String) is:
SHA-1(username + hostname + addSecretForAuthToken() first 20 hexadecimal characters.
where: The Awake Server will use this value to reinforce the strength of the hash value used for Authentication Token at each method call.

Parameters:
username - the database user on whose behalf the connection is being made
Returns:
the computed Authentication Token that will be verified and recomputed at each client call.
Throws:
Exception - if an Exception occurs

forceSecureHttp

boolean forceSecureHttp()
Allows to define if the host url must be accessed in secured httpS. If true, the Awake File Manager or Awake SQL Manager (AwakeFileManager or AwakeSqlManager Servlet) will ask the client side to convert the url scheme from "http" to secure "https" for all server requests. This will be done automatically on the client side prior to authentication.

Returns:
true if the host url must be in httpS

getBannedIPs

List<String> getBannedIPs()
                          throws IOException,
                                 SQLException
Allows to define the list of banned IP addresses. The Awake Server will refuse access to client programs calling with an address in the list.

Subnet notations are supported: 1.1.1.1/255.255.255.255 or 1.1.1.1/32 (CIDR-Notation).

Returns:
the list of banned IP addresses, that are not allowed to access the service
Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

getBannedUsernames

Set<String> getBannedUsernames()
                               throws IOException,
                                      SQLException
Allows to define the set of banned usernames. The Awake Server will refuse access to client programs calling with a username in the set.

Returns:
the set of banned usernames that are not allowed to access the service
Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

getConnection

Connection getConnection()
                         throws SQLException

Attempts to establish a connection with an underlying data source.

Returns:
a connection to the data source
Throws:
SQLException - if a database access error occurs

getEncryptionPassword

char[] getEncryptionPassword()
Allows to define the password that is used to encrypt from the Client all the request parameters values for security reason (obfuscation and transport encryption).

Returns:
the password used to encrypt from Client all the request parameters values for security reason.

getLogger

Logger getLogger()
                 throws IOException
Returns the Logger that will be used by Awake File or Awake SQL logging: It is not necessary nor recommended to implement this method; do it only if you want take control of the logging to modify the default characteristics of DefaultAwakeCommonsConfigurator.getLogger().

Returns:
the java.util.logging.Logger that will be used by Awake File or Awake SQL logging;
Throws:
IOException

login

boolean login(String username,
              char[] password)
              throws IOException,
                     SQLException
Allows to authenticate the remote (username, password) couple send by the client side and to give access to the Awaker Server.

The Awake Server will call the method in order to grant or not client access.

Typical usage would be to check the (username, password) couple against a table in a SQL database or against a LDAP, etc.

Parameters:
username - the username sent by the client login
password - the password to connect to the server

Returns:
true if the (login, password) couple is correct/valid. If false, the client side will not be authorized to send any command.
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