Remove all the {{{ and }}} folding
This commit is contained in:
@@ -68,12 +68,10 @@ class Authentication
|
||||
* @param object $route The route object
|
||||
*/
|
||||
public function __construct ($route)
|
||||
// {{{
|
||||
{
|
||||
$this->route = $route;
|
||||
$this->loggingFunc = array ($this, "logging");
|
||||
}
|
||||
// }}}
|
||||
|
||||
/* public function email ()
|
||||
{
|
||||
@@ -85,21 +83,18 @@ class Authentication
|
||||
* @return integer|self the actual value or this
|
||||
*/
|
||||
public function debug ($debug = null)
|
||||
// {{{
|
||||
{
|
||||
if ($debug === null)
|
||||
return $this->debug;
|
||||
$this->debug = intval ($debug);
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Disconnect the user
|
||||
* @param string|null $url The url to be redirected after a valid
|
||||
* logout
|
||||
*/
|
||||
public function logout ($url = "")
|
||||
// {{{
|
||||
{
|
||||
// TODO : Foreach authentication methods->logout ();
|
||||
if (session_id () === "")
|
||||
@@ -148,14 +143,12 @@ class Authentication
|
||||
else
|
||||
$this->route->redirect ($url);
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Display the login page
|
||||
* @param string|null $url The url to be redirected after a valid
|
||||
* authentication
|
||||
*/
|
||||
public function pageHTML ($url = "")
|
||||
// {{{
|
||||
{
|
||||
// If the user is already connected, redirect to the main page of the site
|
||||
if (session_id () === "")
|
||||
@@ -176,14 +169,12 @@ class Authentication
|
||||
echo $auth->pageHTML ($this->route->baseURL(), $message, $url,
|
||||
$alreadyAuth);
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Check the authentication page
|
||||
* @param string|null $url The url to be redirected after a valid
|
||||
* authentication
|
||||
*/
|
||||
public function verifAuthLoginPage ($url = "")
|
||||
// {{{
|
||||
{
|
||||
if (session_id () === "")
|
||||
session_start ();
|
||||
@@ -265,7 +256,6 @@ class Authentication
|
||||
else
|
||||
$this->route->redirect ("/$url", "");
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Check all the REST API
|
||||
* @param boolean|null $savePassword return the user password if the
|
||||
@@ -273,7 +263,6 @@ class Authentication
|
||||
* @return array The details provided by the authentication mecanism
|
||||
*/
|
||||
public function verifAuthREST ($savePassword = false)
|
||||
// {{{
|
||||
{
|
||||
if ($this->debug)
|
||||
echo "=== entering verifAuthREST (restMethods=".
|
||||
@@ -298,7 +287,6 @@ class Authentication
|
||||
$res["password"] = $authparams->password;
|
||||
return $res;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Return the JSON Web Token
|
||||
* @param string|array $auth The user data to store in JSON Web Token cache.
|
||||
@@ -307,7 +295,6 @@ class Authentication
|
||||
* $this->authServers["authjwt"]["serverKey"] can be set
|
||||
*/
|
||||
public function createJwtToken ($auth)
|
||||
// {{{
|
||||
{
|
||||
if (isset ($this->authServers["authjwt"]["serverKey"]))
|
||||
{
|
||||
@@ -336,13 +323,11 @@ class Authentication
|
||||
return $authjwt->createJwtToken ($payloadArray);
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Check all the others pages of the site
|
||||
* @return array The details provided by the authentication mecanism
|
||||
*/
|
||||
public function verifAuthHTML ()
|
||||
// {{{
|
||||
{
|
||||
// Do not force the session_start ! We don't want the cookie on all the
|
||||
// pages
|
||||
@@ -374,7 +359,6 @@ class Authentication
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Do the real authentication process on all the providers defined in the
|
||||
* properties of the class.
|
||||
@@ -385,7 +369,6 @@ class Authentication
|
||||
* an exception if noting is found
|
||||
*/
|
||||
private function verifAuth ($email, $password)
|
||||
// {{{
|
||||
{
|
||||
if ($this->debug)
|
||||
echo "Entering in verifAuth ($email, xxxxxxxx)\n";
|
||||
@@ -469,13 +452,11 @@ class Authentication
|
||||
}
|
||||
return dgettext ("domframework", "Bad login/password");
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Add the authentication routes to the routing model for HTML
|
||||
* authentication. Not needed if using shibboleth, HTTP auth...
|
||||
*/
|
||||
public function routes ()
|
||||
// {{{
|
||||
{
|
||||
$authObj = $this;
|
||||
$route=$this->route;
|
||||
@@ -510,7 +491,6 @@ class Authentication
|
||||
;
|
||||
$this->route->authenticationURL = "/authentication/";
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** The default method to display the error messages.
|
||||
* Do not display the debug messages, and write the errors on screen
|
||||
@@ -518,11 +498,9 @@ class Authentication
|
||||
* @param string $message The message to log
|
||||
*/
|
||||
private function logging ($priority, $message)
|
||||
// {{{
|
||||
{
|
||||
if ($this->debug === 0 && $priority > 4)
|
||||
return;
|
||||
file_put_contents ("/tmp/auth.log", "$priority : $message\n", FILE_APPEND);
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user