baserCMS クラスリファレンス

RedirectUriValidator
in package
implements RedirectUriValidatorInterface

Redirect URI Validator

league/oauth2-server 8.x 同梱の RedirectUriValidator と同等の検証を行うが、 league/uri 7.x で非推奨となった Uri::createFromString() を使わず、 非推奨でない Uri::new() を使用する。

oauth2-server 9.x(psr/http-message ^2.0 必須)へ上げられない依存事情 (php-mcp/server → react/http が psr/http-message ^1.0 に固定)により、 PHP 8.1 互換を維持したまま当該非推奨を発生させないための差し替え実装。

Tags
see
RedirectUriValidator

Table of Contents

Interfaces

RedirectUriValidatorInterface

Properties

$allowedRedirectUris  : array<string|int, mixed>

Methods

__construct()  : mixed
New validator instance for the given uri
validateRedirectUri()  : bool
Validates the redirect uri.
isLoopbackUri()  : bool
According to section 7.3 of rfc8252, loopback uris are: - "http://127.0.0.1:{port}/{path}" for IPv4 - "http://[::1]:{port}/{path}" for IPv6
matchExactUri()  : bool
Find an exact match among allowed uris
matchUriExcludingPort()  : bool
Find a match among allowed uris, allowing for different port numbers
parseUrlAndRemovePort()  : string
Parse an url like \parse_url, excluding the port

Properties

Methods

__construct()

New validator instance for the given uri

public __construct(string|array<string|int, mixed> $allowedRedirectUri) : mixed
Parameters
$allowedRedirectUri : string|array<string|int, mixed>

validateRedirectUri()

Validates the redirect uri.

public validateRedirectUri(string $redirectUri) : bool
Parameters
$redirectUri : string
Return values
bool

Return true if valid, false otherwise

isLoopbackUri()

According to section 7.3 of rfc8252, loopback uris are: - "http://127.0.0.1:{port}/{path}" for IPv4 - "http://[::1]:{port}/{path}" for IPv6

private isLoopbackUri(string $redirectUri) : bool
Parameters
$redirectUri : string
Return values
bool

matchExactUri()

Find an exact match among allowed uris

private matchExactUri(string $redirectUri) : bool
Parameters
$redirectUri : string
Return values
bool

Return true if an exact match is found, false otherwise

matchUriExcludingPort()

Find a match among allowed uris, allowing for different port numbers

private matchUriExcludingPort(string $redirectUri) : bool
Parameters
$redirectUri : string
Return values
bool

Return true if a match is found, false otherwise

parseUrlAndRemovePort()

Parse an url like \parse_url, excluding the port

private parseUrlAndRemovePort(string $url) : string
Parameters
$url : string
Return values
string
On this page

Search results