Executable
This module performs username and password authentication by using an executable file.
The executable file is expected to return successfully and output JSON to STDOUT.
Example:
<jarvis>
<app>
<login module="Jarvis::Login::Executable">
<parameter name="executable" value="/executable_file_path"/>
</login>
...
The parameters are:
Attribute | Default | Notes |
---|---|---|
executable |
(none) | Absolute path to an executable file for authentication. It will be executed with the username and password as parameters. |
allowed_groups |
* |
Comma-separated list of groups. If specified, restricts login to users with group in allowed groups. Checked after filtering for relevant groups. Wildcard * is supported. |
All spaces and special characters are stripped from the allowed group name.
Executable Result
The result from the executable is expected to provide the following:
Attribute | Default | Notes |
---|---|---|
success |
(none) | A 1 if successful login 0 or not specified if failed. |
groups |
(none) | Comma-separated list of groups. Or an Array of groups that this login/session belongs to. |
message |
(none) | A string to explain the reason why login failed. |
additional |
(none) | An object defining any amount of key=value to assign to the session. Key names for safe parameters must start with __ and will be put into $jconfig->{additional_safe} . |
cookies |
(none) | An object of key=values to be turned into cookies on success login. Any cookies defined in this hash will be sent to the client in a cookie string. |
Note: When this module is used to login, any dataset requests will also have access to any safe parameters returned by the result in the additional object.
These variables can be accessed in a dataset e.g. by specifying {$__variable_name}
. These are “safe” variables in the same sense as e.g. the __username
variable in that they are set purely by Jarvis and cannot be set or modified by the remote client.
Note: It is up to the developer of the executable to ensure the key names are suitable for cookie key names.
An example of success is:
{
"success": 1,
"groups": ["admin"],
"additional": { "__user_id": 1 },
"cookies": { "PHPSESID": "…" }
}
An example of a failure is:
{
"success": 0,
"message": "Banned until 2017/01/01."
}