PHP Класс Imbo\EventListener\AccessToken

This event listener will listen to all GET and HEAD requests and make sure that they include a valid access token. The official PHP-based imbo client (https://github.com/imbo/imboclient-php) appends this token to all such requests by default. If the access token is missing or invalid the event listener will throw an exception resulting in a HTTP response with 400 Bad Request.
Автор: Christer Edvartsen ([email protected])
Наследование: implements Imbo\EventListener\ListenerInterface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( array $params = null ) Class constructor
checkAccessToken ( Imbo\EventManager\EventInterface $event )
getSubscribedEvents ( )

Защищенные методы

Метод Описание
getAlternativeURL ( string $url, integer $encoding = PHP_QUERY_RFC3986 ) : string Helper method to generate an alternative form of an URL, where array indices have either been added or removed. foo[] is transformed into foo[0], while foo[0] is transformed into foo[].
getEscapedAlternativeURL ( $url ) : string Generate an escaped, alternative version of an url.
getUnescapedAlternativeURL ( $url ) : string Generate an unescaped, alternative version of an url.

Приватные методы

Метод Описание
isWhitelisted ( Request $request ) : boolean Check if the request is whitelisted

Описание методов

__construct() публичный Метод

Class constructor
public __construct ( array $params = null )
$params array Parameters for the listener

checkAccessToken() публичный Метод

public checkAccessToken ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface

getAlternativeURL() защищенный Метод

The result for URLs with both formats is undefined, or for URLs that intermingle their parameters, i.e. t[]=foo&b[]=bar&t[]=baz This was introduced because of differences between the URLs generated by the different clients, and because Facebook (at least) generates URLs were []s in URL arguments are expanded to [0] when requested from the backend. Since we sign our URLs, this breaks the token generation and thus breaks URLs when Facebook attempts to retrieve them.
protected getAlternativeURL ( string $url, integer $encoding = PHP_QUERY_RFC3986 ) : string
$url string The URL to generate the alternative form of
$encoding integer The encoding to use - from GuzzleHttp\Psr7
Результат string

getEscapedAlternativeURL() защищенный Метод

Generate an escaped, alternative version of an url.
См. также: AccessToken::getAlternativeURL()
protected getEscapedAlternativeURL ( $url ) : string
$url string The URL to generate the alternative version of
Результат string

getSubscribedEvents() публичный статический Метод

public static getSubscribedEvents ( )

getUnescapedAlternativeURL() защищенный Метод

Generate an unescaped, alternative version of an url.
См. также: AccessToken::getAlternativeURL()
protected getUnescapedAlternativeURL ( $url ) : string
$url string The URL to generate the alternative version of
Результат string