You are here

public function UsernamePassword::validate in DRD Agent 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Agent/Auth/UsernamePassword.php \Drupal\drd_agent\Agent\Auth\UsernamePassword::validate()

Validate authentication of the current request with the given settings.

Parameters

array $settings: Authentication settings from the request.

Return value

bool TRUE if authenticated, FALSE otherwise.

Overrides BaseInterface::validate

File

src/Agent/Auth/UsernamePassword.php, line 15

Class

UsernamePassword
Implements the UsernamePassword authentication method.

Namespace

Drupal\drd_agent\Agent\Auth

Code

public function validate(array $settings) : bool {
  if ($this->currentUser
    ->isAuthenticated()) {
    return TRUE;
  }
  return $this->userAuth
    ->authenticate($settings['username'], $settings['password']);
}