manage responseHeader

This commit is contained in:
a-sansara 2017-03-21 01:22:28 +01:00
parent 6af3e337c4
commit 53c9df92f4

View File

@ -209,6 +209,33 @@ class Authenticator
return new Token($this->config['type'], $key, $date, $tokenValue, $noise);
}
/*!
* @method generateResponseHeader
* @public
* @param MetaTech\PwsAuth\Token $token
* @param str $login
* @return str
*/
public function generateResponseHeader(Token $token, $login)
{
return hash(
self::DEFAULT_ALGO,
$this->formatDate($token->getDate()) . $this->getUserSalt($login) . $token->getValue()
);
}
/*!
* @method checkResponseHeader
* @public
* @param MetaTech\PwsAuth\Token $token
* @param str $login
* @return []
*/
public function checkResponseHeader(Token $token, $login, $responseToken)
{
return $this->generateResponseHeader($token, $login) == $responseToken;
}
/*!
* @method generateHeader
* @public