$auth
$auth : \midcom_services_auth
The simple auth backend uses cookies to store a session identifier which consists of the midgard person GUID.
The validity of the cookie will be controlled by the configuration options auth_backend_simple_cookie_path and auth_backend_simple_cookie_domain:
The path defaults to midcom_connection::get_url('self'). If the domain is set to null (the default), no domain is specified in the cookie, making it a traditional site-specific session cookie. If it is set, the domain parameter of the cookie will be set accordingly.
The basic cookie id (username prefix) is taken from the config option auth_backend_simple_cookie_id, which defaults to 1
$auth : \midcom_services_auth
$session : \midcom_services_session
__construct(\midcom_services_auth $auth)
Read the configuration
\midcom_services_auth | $auth | Main authentication instance |
read_session(\Symfony\Component\HttpFoundation\Request $request) : boolean|array
This function, always called first in the order of execution, should check whether we have a usable login session. It has to use the login session management system to load a login session. At the end of the successful execution of this function, you have to populate the $session and $user members accordingly.
\Symfony\Component\HttpFoundation\Request | $request |
Return clientip, userid and timeout if the login session was successfully loaded, false otherwise.
create_session(string $clientip, \midcom_core_user $user) : boolean
This is called immediately after a new login The authentication driver has to ensure that the login identifier stays available during subsequent requests.
string | $clientip | |
\midcom_core_user | $user |
Indicating success
check_for_active_login_session(\Symfony\Component\HttpFoundation\Request $request) : boolean|\midcom_core_user
Checks for a running login session.
\Symfony\Component\HttpFoundation\Request | $request |
authenticate(string $username, string $password, boolean $trusted = false) : boolean|\midcom_core_user
Does the actual Midgard authentication.
string | $username | The name of the user to authenticate. |
string | $password | The password of the user to authenticate. |
boolean | $trusted |
login(string $username, string $password, string $clientip = null, boolean $trusted = false) : boolean|\midcom_core_user
Creates a login session using the given credentials. It assumes that no login has concluded earlier
string | $username | The name of the user to authenticate. |
string | $password | The password of the user to authenticate. |
string | $clientip | The client IP to which this session is assigned to. This defaults to the client IP reported by the web server |
boolean | $trusted | Do a trusted login |
logout(\midcom_core_user $user)
Deletes login information and session
\midcom_core_user | $user |
check_timestamp( $timestamp, \midcom_core_user $user)
$timestamp | ||
\midcom_core_user | $user |