PHP Class Discourse_SSO

Show file Open project: discourse/wp-discourse Class Usage Examples

Public Methods

Method Description
__construct ( string $secret ) Discourse_SSO constructor.
build_login_string ( array $params ) : string Creates the sso-login query params that are sent to Discourse.
get_nonce ( string $payload ) : mixed Gets the nonce from the payload.
validate ( string $payload, string $sig ) : boolean Validates the payload against the sig.

Method Details

__construct() public method

Discourse_SSO constructor.
public __construct ( string $secret )
$secret string The SSO secret key.

build_login_string() public method

Creates the sso-login query params that are sent to Discourse.
public build_login_string ( array $params ) : string
$params array The array of parameters to send.
return string

get_nonce() public method

Gets the nonce from the payload.
public get_nonce ( string $payload ) : mixed
$payload string A Base64 encoded string.
return mixed

validate() public method

Validates the payload against the sig.
public validate ( string $payload, string $sig ) : boolean
$payload string A Base64 encoded string.
$sig string HMAC-SHA256 of $sso_secret, $payload should be equal to $sig.
return boolean