Class yii\authclient\signature\PlainText

Inheritanceyii\authclient\signature\PlainText » yii\authclient\signature\BaseMethod » yii\base\BaseObject
Available since extension's version2.0
Source Code https://github.com/yiisoft/yii2-authclient/blob/master/src/signature/PlainText.php

PlainText represents 'PLAINTEXT' signature method.

Public Methods

Hide inherited methods

Method Description Defined By
generateSignature() Generates OAuth request signature. yii\authclient\signature\PlainText
getName() Return the canonical name of the Signature Method. yii\authclient\signature\PlainText
verify() Verifies given OAuth request. yii\authclient\signature\BaseMethod

Method Details

Hide inherited methods

generateSignature() public method

Generates OAuth request signature.

public string generateSignature ( $baseString, $key )
$baseString string

Signature base string.

$key string

Signature key.

return string

Signature string.

                public function generateSignature($baseString, $key)
{
    return $key;
}

            
getName() public method

Return the canonical name of the Signature Method.

public string getName ( )
return string

Method name.

                public function getName()
{
    return 'PLAINTEXT';
}

            
verify() public method

Defined in: yii\authclient\signature\BaseMethod::verify()

Verifies given OAuth request.

public boolean verify ( $signature, $baseString, $key )
$signature string

Signature to be verified.

$baseString string

Signature base string.

$key string

Signature key.

return boolean

Success.

                public function verify($signature, $baseString, $key)
{
    $expectedSignature = $this->generateSignature($baseString, $key);
    if (empty($signature) || empty($expectedSignature)) {
        return false;
    }
    return (strcmp($expectedSignature, $signature) === 0);
}