MaxDB PHP Generator online Help
Prev | Return to chapter overview | Next |
User-defined authorization
This kind of authorization allows you to define your own custom authentication. This feature requires you to define a function that takes entered username and password and returns true or false depending on their validity. This means you can use any possible storage for user credentials and any encryption algorithm you like.
Example:
To check that the password is equal to the user name and password contains 5 or more symbols, place the following code to the body of the CheckUserIdentity function. This condition means that the 'John/John' or 'John/Michael' pair will be declined while the 'Michael/Michael' or 'Gloria/Gloria' login/password combination will be accepted.
if ($username == $password)
$result = strlen($password) >= 5;
else
$result = false;
See also: OnGetCustomPagePermissions, OnGetCustomRecordPermissions.
Prev | Return to chapter overview | Next |