Package org.kawanfw.sql.api.server.auth
Class WebServiceUserAuthenticator
java.lang.Object
org.kawanfw.sql.api.server.auth.WebServiceUserAuthenticator
- All Implemented Interfaces:
UserAuthenticator
public class WebServiceUserAuthenticator extends Object implements UserAuthenticator
A concrete
The URL of the Web service is defined in
The Web service must just implement these features:
UserAuthenticator
that allows zero-code remote client
(username, password)
authentication against a Web service. The URL of the Web service is defined in
the webServiceUserAuthenticator.url
in the
aceql-server.properties
file. The Web service must just implement these features:
- It must accept the 2 POST parameters
username
andpassword
. - It must return either:
- The JSON string
{"status"="OK"}
if the authentication succeeds. - The JSON string
{"status"="FAIL"}
if the authentication fails.
- The JSON string
- Since:
- 5.0
- Author:
- Nicolas de Pomereu
- See Also:
UserAuthenticator
-
Constructor Summary
Constructors Constructor Description WebServiceUserAuthenticator()
-
Method Summary
-
Constructor Details
-
WebServiceUserAuthenticator
public WebServiceUserAuthenticator()
-
-
Method Details
-
login
public boolean login(String username, char[] password, String database, String ipAddress) throws IOException, SQLExceptionDescription copied from interface:UserAuthenticator
Allows to authenticate the remote(username, password)
couple sent by the client side.The AceQL HTTP 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 LDAP server or against a SSH server, etc. The method allows to retrieve:
- The name of the database to which the client wants to connect.
- The IP address of the client.
- Specified by:
login
in interfaceUserAuthenticator
- Parameters:
username
- the username sent by the clientpassword
- the password to connect to the serverdatabase
- the database name to which the client wants to connectipAddress
- the IP address of the client user- Returns:
true
if the Authentication Web Service defined inaceql-server.properties
returns the JSON String{"status"="OK"}
, elsefalse
.- Throws:
IOException
- if an IOException occursSQLException
- if a SQLException occurs
-