PHP Класс Jasny\SSO\Broker

The broker lives on the website visited by the user. The broken doesn't have any user credentials stored. Instead it will talk to the SSO server in name of the user, verifying credentials and getting user information.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$broker string My identifier, given by SSO provider.
$token string Session token of the client

Защищенные свойства (Protected)

Свойство Тип Описание
$secret string My secret word, given by SSO provider.
$url string Url of SSO server
$userinfo array User info recieved from the server.

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

Метод Описание
__call ( string $fn, array $args ) : mixed Magic method to do arbitrary request
__construct ( string $url, string $broker, string $secret ) Class constructor
attach ( string | true $returnUrl = null ) Attach our session to the user's session on the SSO server.
clearToken ( ) Clears session token
generateToken ( ) Generate session token
getAttachUrl ( array $params = [] ) : string Get URL to attach session at SSO server.
getUserInfo ( ) : object | null Get user information.
isAttached ( ) : boolean Check if we have an SSO token.
login ( string $username = null, string $password = null ) : array Log the client in at the SSO server.
logout ( ) Logout at sso server.

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

Метод Описание
getCookieName ( ) : string Get the cookie name.
getRequestUrl ( string $command, array $params = [] ) : string Get the request url for a command
getSessionId ( ) : string Generate session id from session key
request ( string $method, string $command, array | string $data = null ) : array | object Execute on SSO server.

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

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

Magic method to do arbitrary request
public __call ( string $fn, array $args ) : mixed
$fn string
$args array
Результат mixed

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

Class constructor
public __construct ( string $url, string $broker, string $secret )
$url string Url of SSO server
$broker string My identifier, given by SSO provider.
$secret string My secret word, given by SSO provider.

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

Attach our session to the user's session on the SSO server.
public attach ( string | true $returnUrl = null )
$returnUrl string | true The URL the client should be returned to after attaching

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

Clears session token
public clearToken ( )

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

Generate session token
public generateToken ( )

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

Get URL to attach session at SSO server.
public getAttachUrl ( array $params = [] ) : string
$params array
Результат string

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

Note: Using the broker name in the cookie name. This resolves issues when multiple brokers are on the same domain.
protected getCookieName ( ) : string
Результат string

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

Get the request url for a command
protected getRequestUrl ( string $command, array $params = [] ) : string
$command string
$params array Query parameters
Результат string

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

Generate session id from session key
protected getSessionId ( ) : string
Результат string

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

Get user information.
public getUserInfo ( ) : object | null
Результат object | null

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

Check if we have an SSO token.
public isAttached ( ) : boolean
Результат boolean

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

Only brokers marked trused can collect and send the user's credentials. Other brokers should omit $username and $password.
public login ( string $username = null, string $password = null ) : array
$username string
$password string
Результат array user info

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

Logout at sso server.
public logout ( )

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

Execute on SSO server.
protected request ( string $method, string $command, array | string $data = null ) : array | object
$method string HTTP method: 'GET', 'POST', 'DELETE'
$command string Command
$data array | string Query or post parameters
Результат array | object

Описание свойств

$broker публичное свойство

My identifier, given by SSO provider.
public string $broker
Результат string

$secret защищенное свойство

My secret word, given by SSO provider.
protected string $secret
Результат string

$token публичное свойство

Session token of the client
public string $token
Результат string

$url защищенное свойство

Url of SSO server
protected string $url
Результат string

$userinfo защищенное свойство

User info recieved from the server.
protected array $userinfo
Результат array