Skip to content

Commit

Permalink
Add docs for #373
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 9, 2020
1 parent b5a1779 commit 50d14ba
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/en/identifiers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,41 @@ Configuration options:
required to pass a valid callback to this option to use the
authenticator.

Callback identifiers can either return ``null|ArrayAccess`` for simple results,
or an ``Authentication\Authenticator\Result`` if you want to forward error
messages::

// A simple callback identifier
$authenticationService->loadIdentifier('Authentication.Identifier', [
'callback' => function($data) {
// do identifier logic

// Return an array of the identified user or null for failure.
if ($result) {
return $result;
}

return null;
}
]);

// Using a result object to return error messages.
$authenticationService->loadIdentifier('Authentication.Identifier', [
'callback' => function($data) {
// do identifier logic

if ($result) {
return new Result($result, Result::SUCCESS);
}

return new Result(
null,
Result::FAILURE_OTHER,
['message' => 'Removed user.']
);
}
]);


Identity resolvers
==================
Expand Down

0 comments on commit 50d14ba

Please sign in to comment.