PHP Class Trianglman\Sqrl\SqrlRequestHandler

This class will process a request, send it to the validator, then depending on the type of request, send a success message, send an error message, or send a request for more information (e.g. initiate the second loop to create a new user)
Author: johnj
Inheritance: implements Trianglman\Sqrl\SqrlRequestHandlerInterface
Show file Open project: trianglman/sqrl Class Usage Examples

Protected Properties

Property Type Description
$actions
$authenticationKey
$clientOptions
$clientSUK
$clientVUK
$config SqrlConfiguration
$ipMatch
$previousIdKey
$requestNut
$responseCode
$sqrlGenerator Trianglman\Sqrl\SqrlGenerateInterface
$store Trianglman\Sqrl\SqrlStoreInterface
$tif
$validator Trianglman\Sqrl\SqrlValidateInterface

Public Methods

Method Description
__construct ( SqrlConfiguration $config, Trianglman\Sqrl\SqrlValidateInterface $val, Trianglman\Sqrl\SqrlStoreInterface $store = null, Trianglman\Sqrl\SqrlGenerateInterface $gen = null )
getResponseCode ( ) : integer Gets the numeric HTTP code to return to the SQRL client
getResponseMessage ( ) : string Gets the text message to be returned to the SQRL client
parseRequest ( array $get, array $post, array $server ) : void Parses a user request
sendResponse ( ) : void A helper function to send the response message and code to the SQRL client

Protected Methods

Method Description
base64URLDecode ( type $string ) : type Base 64 URL decodes a string
base64UrlEncode ( string $string, type $stripEquals = true ) : string Base 64 URL encodes a string
formatResponse ( integer $code ) : string Formats a response to send back to a client
ident ( )
lock ( )
parseClient ( string $clientInput ) : void Takes a (base64Url decoded) client value string and breaks it into its individual values
parseServer ( $serverData )
query ( )

Private Methods

Method Description
identUnknownIdentity ( )
validateSignatures ( $post, $clientInfo )

Method Details

__construct() public method

public __construct ( SqrlConfiguration $config, Trianglman\Sqrl\SqrlValidateInterface $val, Trianglman\Sqrl\SqrlStoreInterface $store = null, Trianglman\Sqrl\SqrlGenerateInterface $gen = null )
$config SqrlConfiguration
$val Trianglman\Sqrl\SqrlValidateInterface
$store Trianglman\Sqrl\SqrlStoreInterface
$gen Trianglman\Sqrl\SqrlGenerateInterface

base64URLDecode() protected method

Basically the same as base64 decoding, but replacing URL safe "-" with "+" and "_" with "/". Automatically detects if the trailing "=" padding has been removed.
protected base64URLDecode ( type $string ) : type
$string type
return type

base64UrlEncode() protected method

Basically the same as base64 encoding, but replacing "+" with "-" and "/" with "_" to make it safe to include in a URL Optionally removes trailing "=" padding characters.
protected base64UrlEncode ( string $string, type $stripEquals = true ) : string
$string string The string to encode
$stripEquals type [Optional] Whether to strip the "=" off of the end
return string

formatResponse() protected method

Formats a response to send back to a client
protected formatResponse ( integer $code ) : string
$code integer The TIF code to send back to the user
return string

getResponseCode() public method

Currently the spec only uses the 200 code and any error message is in the test message response
public getResponseCode ( ) : integer
return integer

getResponseMessage() public method

Gets the text message to be returned to the SQRL client
public getResponseMessage ( ) : string
return string

ident() protected method

protected ident ( )

lock() protected method

protected lock ( )

parseClient() protected method

Takes a (base64Url decoded) client value string and breaks it into its individual values
protected parseClient ( string $clientInput ) : void
$clientInput string
return void

parseRequest() public method

This will determine what type of request is being performed and set values up for use in validation and creating the response.
public parseRequest ( array $get, array $post, array $server ) : void
$get array The user's GET request
$post array The user's POST body
$server array Server level variables (the _SERVER array)
return void

parseServer() protected method

protected parseServer ( $serverData )

query() protected method

protected query ( )

sendResponse() public method

A helper function to send the response message and code to the SQRL client
public sendResponse ( ) : void
return void

Property Details

$actions protected property

protected $actions

$authenticationKey protected property

protected $authenticationKey

$clientOptions protected property

protected $clientOptions

$clientSUK protected property

protected $clientSUK

$clientVUK protected property

protected $clientVUK

$config protected property

protected SqrlConfiguration,Trianglman\Sqrl $config
return SqrlConfiguration

$ipMatch protected property

protected $ipMatch

$previousIdKey protected property

protected $previousIdKey

$requestNut protected property

protected $requestNut

$responseCode protected property

protected $responseCode

$sqrlGenerator protected property

protected SqrlGenerateInterface,Trianglman\Sqrl $sqrlGenerator
return Trianglman\Sqrl\SqrlGenerateInterface

$store protected property

protected SqrlStoreInterface,Trianglman\Sqrl $store
return Trianglman\Sqrl\SqrlStoreInterface

$tif protected property

protected $tif

$validator protected property

protected SqrlValidateInterface,Trianglman\Sqrl $validator
return Trianglman\Sqrl\SqrlValidateInterface