Gateway's Autologin feature lets you configure Gateway to automatically log users in when Gateway is accessed. To use this feature, you must do the following:
Create an autologin module Python script that implements the functions
get_autologin_user
andget_autologin_password
, described below.These functions must return the username and password (respectively) of the user to be logged in. For more details, see Autologin module requirements below.
Enable Autologin in the General settings and upload this script to Gateway.
You can do so from the Customization section of the General settings workflow. For more details, see Enabling Autologin and uploading an Autologin module. You must restart the Gateway container for Autologin changes to take effect.
If Autologin is enabled, Gateway will call these functions whenever a Gateway endpoint is accessed and a user is not logged in. It will then attempt to log in to Gateway using the retrieved credentials.
Autologin module requirements
The Autologin module must be written in Python (typically a *.py
file). It
must implement both the get_autologin_user
and
get_autologin_password
functions, which retrieve the username and
password (respectively) of the user to be logged in.
get_autologin_user
Gateway calls this function as follows:
get_autologin_user: Callable[[bool], Optional[str]]
Parameter | Description |
---|---|
[bool] |
A bool value that indicates whether or not Autologin is enabled. If True, The function must return an appropriate string (see Return value below). |
Optional |
Reserved for future use. |
Return value | A string value. If the If the |
get_autologin_password
Gateway calls this function as follows:
get_autologin_password: Callable[[bool], Optional[str]]
Parameter | Description |
---|---|
[bool] |
A bool value that indicates whether or not Autologin is enabled. If True, The function must return an appropriate string (see Return value below). |
Optional |
Reserved for future use. |
Return value | A string value. If the If the |
Sample Autologin code
It illustrates a possible test implementation of get_autologin_user
and
get_autologin_password
function, for internal use.
def get_autologin_user(autologin):
if autologin:
return 'testname'
else:
return None
def get_autologin_password(autologin):
if autologin:
return 'testpassword'
else:
return None