PHP Class Trianglman\Sqrl\Tests\SqrlRequestHandlerTest

Author: johnj
Inheritance: extends PHPUnit_Framework_TestCase
ファイルを表示 Open project: trianglman/sqrl

Protected Properties

Property Type Description
$config mock Mocked version of \Trianglman\Sqrl\SqrlConfiguration
$generator mock Mocked version of \Trianglman\Sqrl\SqrlGenerate
$handler Trianglman\Sqrl\SqrlRequestHandler The object being tested
$storage mock Mocked version of \Trianglman\Sqrl\SqrlStoreInterface
$validator mock Mocked version of \Trianglman\Sqrl\SqrlValidate

Public Methods

Method Description
setup ( )
testHandlesIncompleteRequest ( ) Tests that the server responds with a client failure flag if the client fails to send all the information needed to make a basic request.
testHandlesRequestWhereServerValueDoesntValidate ( ) Tests that the server responds with a client failure flag if the client sends a server value that doesn't match what the server sent
testHandlesRequestWithInvalidClient ( ) Tests that the server responds with a client failure flag if the client fails to send all the information needed to make a basic request.
testHandlesRequestWithInvalidIDS ( ) Tests that the server responds with a client failure flag if the client sends an invalid IDS signature
testHandlesRequestWithInvalidPIDS ( ) Tests that the server responds with a client failure flag if the client sends an invalid pIDS signature
testHandlesRequestWithInvalidURS ( ) Tests that the server responds with a client failure flag if the client sends an invalid URS signature
testHandlesRequestWithInvalidURSDuringIDUpdate ( ) Tests that the server responds with a client failure flag if the client sends an invalid URS signature
testRespondsToIdent ( ) tests the server responding to a cmd=ident with a known idk
testRespondsToIdentDuringIdentityUpdate ( ) tests the server responding to a cmd=setkey when the user is supplying a pidk in order to update their account.
testRespondsToIdentDuringIdentityUpdateMissingNewSUK ( )
testRespondsToIdentIncompleteAccountInformation ( ) Test that the server returns a failure when the user attempts to create an account without all required information (suk and vuk)
testRespondsToIdentNoUnknownAccountAllowed ( ) Test the server will respond with a function not supported error if the user attempts to create an account when it is not allowed.
testRespondsToIdentWhenCreatingAccount ( ) tests the server responding to a cmd=ident with an unknown idk
testRespondsToLock ( ) tests the server responding to a cmd=lock
testRespondsToLockUnknownAccount ( ) tests the server responding to a cmd=lock when the account doesn't exist
testRespondsToQueryBadNutHardFailure ( ) tests the server responding to a cmd=query when the nut has expired, is unknown, or in some other way is invalid, causing a hard failure
testRespondsToQueryDuringIdentityUpdate ( ) tests the server responding to a cmd=query when the user is supplying a pidk in order to update their account.
testRespondsToQueryExpiredNutSoftFailure ( ) tests the server responding to a cmd=query when the nut has expired
testRespondsToQueryKnownIdentityKey ( ) tests the server responding to a cmd=query when the idk is known
testRespondsToQueryKnownIdentityKeyIPMismatch ( ) tests the server responding to a cmd=query when the idk is known and the IPs do not match
testRespondsToQueryNutKeyMismatch ( ) tests the server responding to a cmd=query when the nut has expired, is unknown, or in some other way is invalid, causing a hard failure
testRespondsToQueryUnknownIdentityKeyAuthenticationProceeds ( ) tests the server responding to a cmd=query with the idk is not known
testRespondsToQueryUnknownIdentityKeyHardFailure ( ) tests the server responding to a cmd=query with the idk is not known
testRespondsToQueryWhenAccountLocked ( ) tests the server responding to a cmd=query when the account has previously been locked
testRespondsToUnlockRequest ( ) tests the server responding to a cmd=ident when the account has previously been locked when the user is supplying the Identity Lock credentials
testRespondsToUnlockRequestMismathedVUK ( )

Protected Methods

Method Description
base64UrlEncode ( $string )

Method Details

base64UrlEncode() protected method

protected base64UrlEncode ( $string )

setup() public method

public setup ( )

testHandlesIncompleteRequest() public method

Tests that the server responds with a client failure flag if the client fails to send all the information needed to make a basic request.

testHandlesRequestWhereServerValueDoesntValidate() public method

Tests that the server responds with a client failure flag if the client sends a server value that doesn't match what the server sent

testHandlesRequestWithInvalidClient() public method

Tests that the server responds with a client failure flag if the client fails to send all the information needed to make a basic request.

testHandlesRequestWithInvalidIDS() public method

Tests that the server responds with a client failure flag if the client sends an invalid IDS signature

testHandlesRequestWithInvalidPIDS() public method

Tests that the server responds with a client failure flag if the client sends an invalid pIDS signature

testHandlesRequestWithInvalidURS() public method

Tests that the server responds with a client failure flag if the client sends an invalid URS signature

testHandlesRequestWithInvalidURSDuringIDUpdate() public method

Tests that the server responds with a client failure flag if the client sends an invalid URS signature

testRespondsToIdent() public method

this should connect the session with the identity key, authorizing the transaction (log-in, purchase authentication, etc.)
public testRespondsToIdent ( )

testRespondsToIdentDuringIdentityUpdate() public method

This should cause the server to replace the previous idk with the newly supplied idk

testRespondsToIdentDuringIdentityUpdateMissingNewSUK() public method

testRespondsToIdentIncompleteAccountInformation() public method

Test that the server returns a failure when the user attempts to create an account without all required information (suk and vuk)

testRespondsToIdentNoUnknownAccountAllowed() public method

Test the server will respond with a function not supported error if the user attempts to create an account when it is not allowed.

testRespondsToIdentWhenCreatingAccount() public method

this should connect the session with the identity key, authorizing the transaction (generally a log in or account creation/association) and that the suk and vuk have been stored

testRespondsToLock() public method

this will lock the user's identity key against further authentication
public testRespondsToLock ( )

testRespondsToLockUnknownAccount() public method

tests the server responding to a cmd=lock when the account doesn't exist

testRespondsToQueryBadNutHardFailure() public method

this will end the authentication transaction

testRespondsToQueryDuringIdentityUpdate() public method

This should return the user's suk value in order to do the full identity unlock process and update the records

testRespondsToQueryExpiredNutSoftFailure() public method

this should cause the client to sign the response with a new query in order to continue authentication

testRespondsToQueryKnownIdentityKey() public method

this will generally be the first step of most authentication, so the server value will be the (s)qrl:// URL

testRespondsToQueryKnownIdentityKeyIPMismatch() public method

this will be both a MITM check and a common case when using a separate device to authenticate so no temporary or permantent failure should be returned

testRespondsToQueryNutKeyMismatch() public method

this will end the authentication transaction

testRespondsToQueryUnknownIdentityKeyAuthenticationProceeds() public method

this is in the instance where the server will allow the authentication to proceed generally this will be on a create account or associate account with SQRL page

testRespondsToQueryUnknownIdentityKeyHardFailure() public method

this is in the instance where the server does not allow previously unknown identities to authenticate to the server

testRespondsToQueryWhenAccountLocked() public method

this should return the suk value previously supplied by the user in order for the client to complete the identity unlock process

testRespondsToUnlockRequest() public method

this will validate both the identity and the vuk/urs process was completed then unlock the idk for future authentication

testRespondsToUnlockRequestMismathedVUK() public method

Property Details

$config protected_oe property

Mocked version of \Trianglman\Sqrl\SqrlConfiguration
protected mock $config
return mock

$generator protected_oe property

Mocked version of \Trianglman\Sqrl\SqrlGenerate
protected mock $generator
return mock

$handler protected_oe property

The object being tested
protected SqrlRequestHandler,Trianglman\SQRL $handler
return Trianglman\Sqrl\SqrlRequestHandler

$storage protected_oe property

Mocked version of \Trianglman\Sqrl\SqrlStoreInterface
protected mock $storage
return mock

$validator protected_oe property

Mocked version of \Trianglman\Sqrl\SqrlValidate
protected mock $validator
return mock