functions.php
Table of Contents
- generateRandomString() : string
- generateRandomPrintableAsciiString() : string
- generatePKCECodeChallenge() : string
- base64_urlencode() : string
- hashAuthorizationRequestParameters() : string|null
- isIndieAuthAuthorizationCodeRedeemingRequest() : bool
- isIndieAuthAuthorizationRequest() : bool
- isAuthorizationApprovalRequest() : bool
- buildQueryString() : string
- urlComponentsMatch() : bool
- appendQueryParams() : string
- Append Query Parameters
- trySetLogger() : mixed
- Try setLogger
- renderTemplate() : mixed
- isClientIdentifier() : bool
- Check if a provided string matches the IndieAuth criteria for a Client Identifier.
- isProfileUrl() : bool
- Check if a provided string matches the IndieAuth criteria for a User Profile URL.
- isValidState() : bool
- OAuth 2.0 limits what values are valid for state.
- isValidCodeChallenge() : bool
- IndieAuth requires PKCE. This implementation supports only S256 for hashing.
- isValidScope() : bool
- OAuth 2.0 limits what values are valid for scope.
Functions
generateRandomString()
generateRandomString(int $numBytes) : string
Parameters
- $numBytes : int
Return values
string —generateRandomPrintableAsciiString()
generateRandomPrintableAsciiString(int $length) : string
Parameters
- $length : int
Return values
string —generatePKCECodeChallenge()
generatePKCECodeChallenge(string $plaintext) : string
Parameters
- $plaintext : string
Return values
string —base64_urlencode()
base64_urlencode(string $string) : string
Parameters
- $string : string
Return values
string —hashAuthorizationRequestParameters()
hashAuthorizationRequestParameters(ServerRequestInterface $request, string $secret[, string|null $algo = null ][, array<string|int, mixed>|null $hashedParameters = null ][, bool $requirePkce = true ]) : string|null
Parameters
- $request : ServerRequestInterface
- $secret : string
- $algo : string|null = null
- $hashedParameters : array<string|int, mixed>|null = null
- $requirePkce : bool = true
Return values
string|null —isIndieAuthAuthorizationCodeRedeemingRequest()
isIndieAuthAuthorizationCodeRedeemingRequest(ServerRequestInterface $request) : bool
Parameters
- $request : ServerRequestInterface
Return values
bool —isIndieAuthAuthorizationRequest()
isIndieAuthAuthorizationRequest(ServerRequestInterface $request[, array<string|int, mixed> $permittedMethods = ['get'] ]) : bool
Parameters
- $request : ServerRequestInterface
- $permittedMethods : array<string|int, mixed> = ['get']
Return values
bool —isAuthorizationApprovalRequest()
isAuthorizationApprovalRequest(ServerRequestInterface $request) : bool
Parameters
- $request : ServerRequestInterface
Return values
bool —buildQueryString()
buildQueryString(array<string|int, mixed> $parameters) : string
Parameters
- $parameters : array<string|int, mixed>
Return values
string —urlComponentsMatch()
urlComponentsMatch(string $url1, string $url2[, array<string|int, mixed>|null $components = null ]) : bool
Parameters
- $url1 : string
- $url2 : string
- $components : array<string|int, mixed>|null = null
Return values
bool —appendQueryParams()
Append Query Parameters
appendQueryParams(string $uri, array<string|int, mixed> $queryParams) : string
Converts $queryParams
into a query string, then checks $uri
for an
existing query string. Then appends the newly generated query string
with either ? or & as appropriate.
Parameters
- $uri : string
- $queryParams : array<string|int, mixed>
Return values
string —trySetLogger()
Try setLogger
trySetLogger(mixed $target, LoggerInterface $logger) : mixed
If $target
implements LoggerAwareInterface
, set it’s logger
to $logger
. Returns $target
.
Parameters
- $target : mixed
- $logger : LoggerInterface
Tags
Return values
mixed —renderTemplate()
renderTemplate(string $template[, array<string|int, mixed> $context = [] ]) : mixed
Parameters
- $template : string
- $context : array<string|int, mixed> = []
Return values
mixed —isClientIdentifier()
Check if a provided string matches the IndieAuth criteria for a Client Identifier.
isClientIdentifier(string $client_id) : bool
Parameters
- $client_id : string
-
The client ID provided by the OAuth Client
Tags
Return values
bool —true if the value is allowed by IndieAuth
isProfileUrl()
Check if a provided string matches the IndieAuth criteria for a User Profile URL.
isProfileUrl(string $profile_url) : bool
Parameters
- $profile_url : string
-
The profile URL provided by the IndieAuth Client as me
Tags
Return values
bool —true if the value is allowed by IndieAuth
isValidState()
OAuth 2.0 limits what values are valid for state.
isValidState(string $state) : bool
We check this first, because if valid, we want to send it along with other errors.
Parameters
- $state : string
Tags
Return values
bool —isValidCodeChallenge()
IndieAuth requires PKCE. This implementation supports only S256 for hashing.
isValidCodeChallenge(string $challenge) : bool
Parameters
- $challenge : string
Tags
Return values
bool —isValidScope()
OAuth 2.0 limits what values are valid for scope.
isValidScope(string $scope) : bool
Parameters
- $scope : string