class SecurityToken (View source)

Provides the ability to generate cryptographically secure tokens for comment moderation

Methods

public
__construct(Comment $comment)

No description

protected
string
getToken(string $salt)

Generate the token for the given salt and current secret

protected
string
memberSalt(string $salt, Member $member)

Get the member-specific salt.

public
string
addToUrl(string $url, Member $member)

No description

public
bool
checkRequest(SS_HTTPRequest $request)

No description

protected
string
generate(int $length = null)

Generates new random key

Details

__construct(Comment $comment)

No description

Parameters

Comment $comment

Comment to generate this token for

protected string getToken(string $salt)

Generate the token for the given salt and current secret

Parameters

string $salt

Return Value

string

protected string memberSalt(string $salt, Member $member)

Get the member-specific salt.

The reason for making the salt specific to a user is that it cannot be "passed in" via a querystring, requiring the same user to be present at both the link generation and the controller action.

Parameters

string $salt

Single use salt

Member $member

Member object

Return Value

string

Generated salt specific to this member

string addToUrl(string $url, Member $member)

No description

Parameters

string $url

Comment action URL

Member $member

Member to restrict access to this action to

Return Value

string

bool checkRequest(SS_HTTPRequest $request)

No description

Parameters

SS_HTTPRequest $request

Return Value

bool

protected string generate(int $length = null)

Generates new random key

Parameters

int $length

Return Value

string