|
Awake SQL v1.2.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.awakefw.commons.api.server.DefaultAwakeCommonsConfigurator
public class DefaultAwakeCommonsConfigurator
Default implementation of the commons User Configuration for the Awake Framework.
This defaults implementation will help for a quick start and to test the
Awake Framework, but please note that is implementation is not secure
at all.
Especially: the login method will always return
true.
So:
forceSecureHttp method should be set to true by your
implementation in order to prevent the login info and the data to be send in
clear over the Internet with http protocollogin method should be overridden by your specific
implementation.
| Constructor Summary | |
|---|---|
DefaultAwakeCommonsConfigurator()
Constructor. |
|
| 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)
This default method is secure if client side always use SSL/TLS httpS calls. |
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. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultAwakeCommonsConfigurator()
| Method Detail |
|---|
public String addSecretForAuthToken()
throws IOException,
SQLException
AwakeCommonsConfiguratorcomputeAuthToken.
addSecretForAuthToken in interface AwakeCommonsConfiguratornull. It is highly recommended to override
this method in order to set a secret value in order to reinforce
the security of the Awake Server.
IOException - if an IOException occurs
SQLException - if a SQLException occursAwakeCommonsConfigurator.computeAuthToken(java.lang.String)
public String computeAuthToken(String username)
throws Exception
computeAuthToken in interface AwakeCommonsConfiguratorusername - the database user on whose behalf the connection is being made
SHA-1(username + hostname + addSecretForAuthToken())
first 20 hexadecimal characters.Exception - if an Exception occurspublic boolean forceSecureHttp()
AwakeCommonsConfigurator
forceSecureHttp in interface AwakeCommonsConfiguratorfalse. (Client programs will be allowed to send
unsecured http requests).
public List<String> getBannedIPs()
throws IOException,
SQLException
AwakeCommonsConfiguratorSubnet notations are supported: 1.1.1.1/255.255.255.255 or 1.1.1.1/32 (CIDR-Notation).
getBannedIPs in interface AwakeCommonsConfiguratorArrayList. (No banned IP addresses.)
IOException - if an IOException occurs
SQLException - if a SQLException occurs
public Set<String> getBannedUsernames()
throws IOException,
SQLException
AwakeCommonsConfigurator
getBannedUsernames in interface AwakeCommonsConfiguratorHashSet. (No banned IP usernames.)
IOException - if an IOException occurs
SQLException - if a SQLException occurs
public Connection getConnection()
throws SQLException
AwakeCommonsConfiguratorAttempts to establish a connection with an underlying data source.
getConnection in interface AwakeCommonsConfiguratorAwakeDataSource
DataSource defined as a 'jdbc/awake-default'
Resource in server.xml or context.xml. The Awake
DataSource implements a default connection pool manager.
SQLException - if a database access error occurspublic char[] getEncryptionPassword()
AwakeCommonsConfigurator
getEncryptionPassword in interface AwakeCommonsConfiguratornull. It is highly recommended to override
this method in order to set a secret password in order to
reinforce the security of the transport of request parameters.
public Logger getLogger()
throws IOException
AwakeCommonsConfiguratorLogger that will be used by Awake File or Awake SQL
logging:
Level.WARNING.getLogger().
getLogger in interface AwakeCommonsConfiguratoruser.home/.awake/log/Awake.log, that uses a
SimpleFormatter and that logs 50Mb into 4 rotating
files.
IOException
public boolean login(String username,
char[] password)
throws IOException,
SQLException
AwakeCommonsConfiguratorThe 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.
login in interface AwakeCommonsConfiguratorusername - the username sent by the client loginpassword - the password to connect to the server
true. (Client is always granted access).
IOException - if an IOException occurs
SQLException - if a SQLException occurs
|
Awake SQL v1.2.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||