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

Protected Properties

Свойство Type Description
$brokerId mixed
$cache Desarrolla2\Cache\Cache Cache that stores the special session data for the brokers.
$options array
$returnType string

Méthodes publiques

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

Méthodes protégées

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

Method Details

__construct() public méthode

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

attach() public méthode

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

authenticate() abstract protected méthode

Authenticate using user credentials
abstract protected authenticate ( string $username, string $password ) : Jasny\ValidationResult
$username string
$password string
Résultat Jasny\ValidationResult

createCacheAdapter() protected méthode

Create a cache to store the broker session id.
protected createCacheAdapter ( ) : Desarrolla2\Cache\Cache
Résultat Desarrolla2\Cache\Cache

detectReturnType() protected méthode

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

fail() protected méthode

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

generateAttachChecksum() protected méthode

Generate session id from session token
protected generateAttachChecksum ( string $brokerId, string $token ) : string
$brokerId string
$token string
Résultat string

generateSessionId() protected méthode

Generate session id from session token
protected generateSessionId ( string $brokerId, string $token ) : string
$brokerId string
$token string
Résultat string

getBrokerInfo() abstract protected méthode

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

getBrokerSessionID() protected méthode

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

getSessionData() protected méthode

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

getUserInfo() abstract protected méthode

Get the information about a user
abstract protected getUserInfo ( string $username ) : array | object
$username string
Résultat array | object

login() public méthode

Authenticate
public login ( )

logout() public méthode

Log out
public logout ( )

outputAttachSuccess() protected méthode

Output on a successful attach
protected outputAttachSuccess ( )

outputImage() protected méthode

Output a 1x1px transparent image
protected outputImage ( )

setSessionData() protected méthode

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

startBrokerSession() public méthode

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

startUserSession() protected méthode

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

userInfo() public méthode

Ouput user information as json.
public userInfo ( )

validateBrokerSessionId() protected méthode

Validate the broker session id
protected validateBrokerSessionId ( string $sid ) : string
$sid string session id
Résultat string the broker id

Property Details

$brokerId protected_oe property

protected mixed $brokerId
Résultat mixed

$cache protected_oe property

Cache that stores the special session data for the brokers.
protected Cache,Desarrolla2\Cache $cache
Résultat Desarrolla2\Cache\Cache

$options protected_oe property

protected array $options
Résultat array

$returnType protected_oe property

protected string $returnType
Résultat string