Elgg  Version 4.x
ElggPAM.php
Go to the documentation of this file.
1 <?php
2 
4 
10 class ElggPAM {
11 
15  protected $policy;
16 
20  protected $message;
21 
27  public function __construct($policy) {
28  $this->policy = $policy;
29  }
30 
46  public function authenticate($credentials = []) {
47 
48  try {
49  return elgg_pam_authenticate($this->policy, $credentials);
50  } catch (AuthenticationException $e) {
51  $this->message = $e->getMessage();
52  }
53 
54  return false;
55  }
56 
62  public function getFailureMessage() {
63  $message = _elgg_services()->translator->translate('auth:nopams');
64  if (!empty($this->message)) {
66  }
67 
68  return _elgg_services()->hooks->triggerDeprecated('fail', 'auth', $this->message, $message, "The 'fail', 'auth' hook is deprecated", '4.3');
69  }
70 }
__construct($policy)
constructor
Definition: ElggPAM.php:27
$message
Definition: ElggPAM.php:20
Elgg login action.
authenticate($credentials=[])
Authenticate a set of credentials against a policy This function will process all registered PAM hand...
Definition: ElggPAM.php:46
Thrown by the AuthenticationService.
Pluggable Authentication Module.
Definition: ElggPAM.php:10
$result message
elgg_pam_authenticate(string $policy, array $authentication_params=[])
Start an authentication process.
Definition: pam.php:58
_elgg_services()
Get the global service provider.
Definition: elgglib.php:777
getFailureMessage()
Get a failure message to display to user.
Definition: ElggPAM.php:62