- ⌂ framework
- Methods
framework::require_login()
Secures an app, package or URL by requiring the browser to be logged in to webCOMAND.
The current web request is utilized to determine, based on a session cookie, if the browser is logged in to webCOMAND. If not, the browser will be redirected to the webCOMAND Sign In, and then directed back to the original URL upon successful login.
Prototype
user_session require_login(boolean $session_only = FALSE)
Parameters
- session_only - Set to TRUE to simply return a 401 HTTP response if the browser is not logged in to webCOMAND, rather than redirecting to the webCOMAND Sign In.
Example
<?php
$repo = \comand::repo();
$framework = new \com_webcomand\framework($repo);
$framework->require_login();
$user = $framework->get_end_user();