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.
파일 보기 프로젝트 열기: jasny/sso

공개 프로퍼티들

프로퍼티 타입 설명
$broker string My identifier, given by SSO provider.
$token string Session token of the client

보호된 프로퍼티들

프로퍼티 타입 설명
$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