PHP Class 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.
Afficher le fichier Open project: jasny/sso

Méthodes publiques

Свойство Type Description
$broker string My identifier, given by SSO provider.
$token string Session token of the client

Protected Properties

Свойство Type Description
$secret string My secret word, given by SSO provider.
$url string Url of SSO server
$userinfo array User info recieved from the server.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
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.

Method Details

__call() public méthode

Magic method to do arbitrary request
public __call ( string $fn, array $args ) : mixed
$fn string
$args array
Résultat mixed

__construct() public méthode

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() public méthode

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() public méthode

Clears session token
public clearToken ( )

generateToken() public méthode

Generate session token
public generateToken ( )

getAttachUrl() public méthode

Get URL to attach session at SSO server.
public getAttachUrl ( array $params = [] ) : string
$params array
Résultat string

getCookieName() protected méthode

Note: Using the broker name in the cookie name. This resolves issues when multiple brokers are on the same domain.
protected getCookieName ( ) : string
Résultat string

getRequestUrl() protected méthode

Get the request url for a command
protected getRequestUrl ( string $command, array $params = [] ) : string
$command string
$params array Query parameters
Résultat string

getSessionId() protected méthode

Generate session id from session key
protected getSessionId ( ) : string
Résultat string

getUserInfo() public méthode

Get user information.
public getUserInfo ( ) : object | null
Résultat object | null

isAttached() public méthode

Check if we have an SSO token.
public isAttached ( ) : boolean
Résultat boolean

login() public méthode

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
Résultat array user info

logout() public méthode

Logout at sso server.
public logout ( )

request() protected méthode

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
Résultat array | object

Property Details

$broker public_oe property

My identifier, given by SSO provider.
public string $broker
Résultat string

$secret protected_oe property

My secret word, given by SSO provider.
protected string $secret
Résultat string

$token public_oe property

Session token of the client
public string $token
Résultat string

$url protected_oe property

Url of SSO server
protected string $url
Résultat string

$userinfo protected_oe property

User info recieved from the server.
protected array $userinfo
Résultat array