Improved naming of authentication callback config key

This commit is contained in:
Barnaby Walters 2021-06-13 00:19:16 +02:00
parent 62d02dacc0
commit 7f1cb9e8b2
4 changed files with 7 additions and 7 deletions

View File

@ -111,7 +111,7 @@ YOUR_HASHED_PASSWORD = password_hash('my super strong password', PASSWORD_DEFAUL
use Taproot\IndieAuth; use Taproot\IndieAuth;
$server = new IndieAuth\Server([ $server = new IndieAuth\Server([
'handleAuthenticationRequestCallback' => new IndieAuth\Callback\SingleUserPasswordAuthenticationCallback( 'authenticationHandler' => new IndieAuth\Callback\SingleUserPasswordAuthenticationCallback(
['me' => 'https://me.example.com/'], ['me' => 'https://me.example.com/'],
YOUR_HASHED_PASSWORD YOUR_HASHED_PASSWORD
) )

View File

@ -107,7 +107,7 @@ $server = new Taproot\IndieAuth\Server([
// An authentication callback function, which either returns data about the current user, // An authentication callback function, which either returns data about the current user,
// or redirects to/implements an authentication flow. // or redirects to/implements an authentication flow.
'handleAuthenticationRequestCallback' => function (ServerRequestInterface $request, string $authenticationRedirect, ?string $normalizedMeUrl) { 'authenticationHandler' => function (ServerRequestInterface $request, string $authenticationRedirect, ?string $normalizedMeUrl) {
// If the request is authenticated, return an array with a `me` key containing the // If the request is authenticated, return an array with a `me` key containing the
// canonical URL of the currently logged-in user. // canonical URL of the currently logged-in user.
if ($userUrl = getLoggedInUserUrl($request)) { if ($userUrl = getLoggedInUserUrl($request)) {
@ -210,7 +210,7 @@ documentation for both handling methods for further documentation about them.</p
<dt class="phpdocumentor-table-of-contents__entry -constant -public"> <dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a href="classes/Taproot-IndieAuth-Server.html#constant_HANDLE_AUTHENTICATION_REQUEST">HANDLE_AUTHENTICATION_REQUEST</a> <a href="classes/Taproot-IndieAuth-Server.html#constant_HANDLE_AUTHENTICATION_REQUEST">HANDLE_AUTHENTICATION_REQUEST</a>
<span> <span>
&nbsp;= &#039;handleAuthenticationRequestCallback&#039; </span> &nbsp;= &#039;authenticationHandler&#039; </span>
</dt> </dt>
<dd></dd> <dd></dd>
@ -434,7 +434,7 @@ documentation for both handling methods for further documentation about them.</p
<span class="phpdocumentor-signature__visibility">public</span> <span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">mixed</span> <span class="phpdocumentor-signature__type">mixed</span>
<span class="phpdocumentor-signature__name">HANDLE_AUTHENTICATION_REQUEST</span> <span class="phpdocumentor-signature__name">HANDLE_AUTHENTICATION_REQUEST</span>
= <span class="phpdocumentor-signature__default-value">&#039;handleAuthenticationRequestCallback&#039;</span> = <span class="phpdocumentor-signature__default-value">&#039;authenticationHandler&#039;</span>
</code> </code>

View File

@ -31,7 +31,7 @@ use function Taproot\IndieAuth\renderTemplate;
* use Taproot\IndieAuth; * use Taproot\IndieAuth;
* $server = new IndieAuth\Server([ * $server = new IndieAuth\Server([
* *
* 'handleAuthenticationRequestCallback' => new IndieAuth\Callback\SingleUserPasswordAuthenticationCallback( * 'authenticationHandler' => new IndieAuth\Callback\SingleUserPasswordAuthenticationCallback(
* ['me' => 'https://me.example.com/'], * ['me' => 'https://me.example.com/'],
* YOUR_HASHED_PASSWORD * YOUR_HASHED_PASSWORD
* ) * )

View File

@ -39,7 +39,7 @@ use Taproot\IndieAuth\Storage\TokenStorageInterface;
* *
* // An authentication callback function, which either returns data about the current user, * // An authentication callback function, which either returns data about the current user,
* // or redirects to/implements an authentication flow. * // or redirects to/implements an authentication flow.
* 'handleAuthenticationRequestCallback' => function (ServerRequestInterface $request, string $authenticationRedirect, ?string $normalizedMeUrl) { * 'authenticationHandler' => function (ServerRequestInterface $request, string $authenticationRedirect, ?string $normalizedMeUrl) {
* // If the request is authenticated, return an array with a `me` key containing the * // If the request is authenticated, return an array with a `me` key containing the
* // canonical URL of the currently logged-in user. * // canonical URL of the currently logged-in user.
* if ($userUrl = getLoggedInUserUrl($request)) { * if ($userUrl = getLoggedInUserUrl($request)) {
@ -77,7 +77,7 @@ use Taproot\IndieAuth\Storage\TokenStorageInterface;
*/ */
class Server { class Server {
const HANDLE_NON_INDIEAUTH_REQUEST = 'handleNonIndieAuthRequestCallback'; const HANDLE_NON_INDIEAUTH_REQUEST = 'handleNonIndieAuthRequestCallback';
const HANDLE_AUTHENTICATION_REQUEST = 'handleAuthenticationRequestCallback'; const HANDLE_AUTHENTICATION_REQUEST = 'authenticationHandler';
/** /**
* The query string parameter key used for storing the hash used for validating authorization request parameters. * The query string parameter key used for storing the hash used for validating authorization request parameters.