Receives values from the remote database that can be used to authenticate beyond a user ID and password. The values can also be used to arbitrarily customize each synchronization.
In the following table, the description provides the SQL data type. If you are writing your script in Java or .NET, you should use the appropriate corresponding data type. See SQL-Java data types and SQL-.NET data types.
In SQL scripts, you can specify event parameters by name or with a question mark. Using question marks has been deprecated and it is recommended that you use named parameters. You cannot mix names and question marks within a script. If you use question marks, the parameters must be in the order shown below and are optional only if no subsequent parameters are specified (for example, you must use parameter 1 if you want to use parameter 2). If you use named parameters, you can specify any subset of the parameters in any order.
Parameter name for SQL scripts | Description | Order (deprecated for SQL) |
---|---|---|
s.authentication_status | INTEGER. This is an INOUT parameter. | 1 |
s.remote_id | VARCHAR(128). The MobiLink remote ID. You can only reference the remote ID if you are using named parameters. | Not applicable |
s.username | VARCHAR(128). The MobiLink user name. | 2 |
a.N (one or more) | VARCHAR(4000). For example, named parameters could be a.1 a.2 .
|
3 or higher |
authentication_status The authentication_status parameter is required. It indicates the overall success of the authentication, and can be set to one of the following values:
Returned Value | authentication_status | Description |
---|---|---|
V <= 1999 | 1000 | Authentication succeeded. |
1000 <= V <= 2999 | 2000 | Authentication succeeded, but password expiring soon. |
2000 <= V <= 3999 | 3000 | Authentication failed as password has expired. |
4000 <= V <= 4999 | 4000 | Authentication failed. |
5000 <= V <= 5999 | 5000 | Unable to authenticate because the remote ID is already in use. Try the synchronization again later. |
6000 <= V | 4000 | If the returned value is greater than 5999, MobiLink interprets it as a returned value of 4000 (authentication failed). |
username This parameter is the MobiLink user name. VARCHAR(128).
remote_ID The MobiLink remote ID. You can only reference the remote ID if you are using named parameters.
remote a.N The Nth authentication parameter sent up from the remote client.
The number of remote parameters must match the number expected by the authenticate_parameters script or an error results. An error also occurs if parameters are sent from the client and there is no script for this event.
You can send strings (or parameters in the form of strings) from both SQL Anywhere and UltraLite clients. This allows you to have authentication beyond a user ID and password. It also means that you can customize your synchronization based on the value of parameters, and do this in a pre-synchronization phase, during authentication. These parameters may also be referenced from any synchronization script.
The MobiLink server executes this event upon starting each synchronization. It is executed in the same transaction as the authenticate_user event.
You can use this event to replace the built-in MobiLink authentication mechanism with a custom mechanism. You may want to call into the authentication mechanism of your DBMS, or you may want to implement features not present in the MobiLink built-in mechanism.
If the authenticate_user or authenticate_user_hashed scripts are invoked and return an error, this event is not called.
SQL scripts for the authenticate_parameters event must be implemented as stored procedures.
For UltraLite remote databases, pass the parameters using the num_auth_parms and auth_parms fields in the ul_sync_info struct. num_auth_parms is a count of the number of parameters, from 0 to 255. auth_parms is a pointer to an array of strings. To prevent the strings from being viewed as plain text, the strings are sent using the same obfuscation as passwords. If num_auth_parms is 0, set auth_parms to null. The following is an example of passing parameters in UltraLite:
ul_char * Params[ 3 ] = { UL_TEXT( "param1" ), UL_TEXT( "param2" ), UL_TEXT( "param3" ) }; ... info.num_auth_parms = 3; info.auth_parms = Params; |
For SQL Anywhere remote databases, you pass parameters using the dbmlsync -ap option, in a comma-separated list. For example, the following command line passes three parameters:
dbmlsync -ap "param1,param2,param3" |
In this example, the authenticate_parameters script could be:
CALL my_auth_parm ( {ml s.authentication_status}, {ml s.remote_id}, {ml s.username}, {ml a.1}, {ml a.2}, {ml a.3} ) |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |