PHP 클래스 Jasny\SSO\Server

The SSO server is responsible of managing users sessions which are available for brokers. To use the SSO server, extend this class and implement the abstract methods. This class may be used as controller in an MVC application.
파일 보기 프로젝트 열기: jasny/sso

보호된 프로퍼티들

프로퍼티 타입 설명
$brokerId mixed
$cache Desarrolla2\Cache\Cache Cache that stores the special session data for the brokers.
$options array
$returnType string

공개 메소드들

메소드 설명
__construct ( array $options = [] ) Class constructor
attach ( ) Attach a user session to a broker session
login ( ) Authenticate
logout ( ) Log out
startBrokerSession ( ) Start the session for broker requests to the SSO server
userInfo ( ) Ouput user information as json.

보호된 메소드들

메소드 설명
authenticate ( string $username, string $password ) : Jasny\ValidationResult Authenticate using user credentials
createCacheAdapter ( ) : Desarrolla2\Cache\Cache Create a cache to store the broker session id.
detectReturnType ( ) Detect the type for the HTTP response.
fail ( string $message, integer $http_status = 500 ) An error occured.
generateAttachChecksum ( string $brokerId, string $token ) : string Generate session id from session token
generateSessionId ( string $brokerId, string $token ) : string Generate session id from session token
getBrokerInfo ( string $brokerId ) : array Get the secret key and other info of a broker
getBrokerSessionID ( ) Get session ID from header Authorization or from $_GET/$_POST
getSessionData ( type $key ) Get session data
getUserInfo ( string $username ) : array | object Get the information about a user
outputAttachSuccess ( ) Output on a successful attach
outputImage ( ) Output a 1x1px transparent image
setSessionData ( string $key, string $value ) Set session data
startUserSession ( ) Start the session when a user visits the SSO server
validateBrokerSessionId ( string $sid ) : string Validate the broker session id

메소드 상세

__construct() 공개 메소드

Class constructor
public __construct ( array $options = [] )
$options array

attach() 공개 메소드

Attach a user session to a broker session
public attach ( )

authenticate() 추상적인 보호된 메소드

Authenticate using user credentials
abstract protected authenticate ( string $username, string $password ) : Jasny\ValidationResult
$username string
$password string
리턴 Jasny\ValidationResult

createCacheAdapter() 보호된 메소드

Create a cache to store the broker session id.
protected createCacheAdapter ( ) : Desarrolla2\Cache\Cache
리턴 Desarrolla2\Cache\Cache

detectReturnType() 보호된 메소드

Should only be done for an attach request.
protected detectReturnType ( )

fail() 보호된 메소드

An error occured.
protected fail ( string $message, integer $http_status = 500 )
$message string
$http_status integer

generateAttachChecksum() 보호된 메소드

Generate session id from session token
protected generateAttachChecksum ( string $brokerId, string $token ) : string
$brokerId string
$token string
리턴 string

generateSessionId() 보호된 메소드

Generate session id from session token
protected generateSessionId ( string $brokerId, string $token ) : string
$brokerId string
$token string
리턴 string

getBrokerInfo() 추상적인 보호된 메소드

Get the secret key and other info of a broker
abstract protected getBrokerInfo ( string $brokerId ) : array
$brokerId string
리턴 array

getBrokerSessionID() 보호된 메소드

Get session ID from header Authorization or from $_GET/$_POST
protected getBrokerSessionID ( )

getSessionData() 보호된 메소드

Get session data
protected getSessionData ( type $key )
$key type

getUserInfo() 추상적인 보호된 메소드

Get the information about a user
abstract protected getUserInfo ( string $username ) : array | object
$username string
리턴 array | object

login() 공개 메소드

Authenticate
public login ( )

logout() 공개 메소드

Log out
public logout ( )

outputAttachSuccess() 보호된 메소드

Output on a successful attach
protected outputAttachSuccess ( )

outputImage() 보호된 메소드

Output a 1x1px transparent image
protected outputImage ( )

setSessionData() 보호된 메소드

Set session data
protected setSessionData ( string $key, string $value )
$key string
$value string

startBrokerSession() 공개 메소드

Start the session for broker requests to the SSO server
public startBrokerSession ( )

startUserSession() 보호된 메소드

Start the session when a user visits the SSO server
protected startUserSession ( )

userInfo() 공개 메소드

Ouput user information as json.
public userInfo ( )

validateBrokerSessionId() 보호된 메소드

Validate the broker session id
protected validateBrokerSessionId ( string $sid ) : string
$sid string session id
리턴 string the broker id

프로퍼티 상세

$brokerId 보호되어 있는 프로퍼티

protected mixed $brokerId
리턴 mixed

$cache 보호되어 있는 프로퍼티

Cache that stores the special session data for the brokers.
protected Cache,Desarrolla2\Cache $cache
리턴 Desarrolla2\Cache\Cache

$options 보호되어 있는 프로퍼티

protected array $options
리턴 array

$returnType 보호되어 있는 프로퍼티

protected string $returnType
리턴 string