123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace fphammerle\yii2\auth\clientcert\tests\models;
- class User extends \yii\db\ActiveRecord
- implements \yii\web\IdentityInterface
- {
- public static function tableName()
- {
- return 'user';
- }
- public function __construct($username = null)
- {
- $this->username = $username;
- }
- public static function findIdentity($id)
- {
- return static::findOne(['id' => $id]);
- }
- public static function findIdentityByAccessToken($token, $type = null)
- {
- throw new NotSupportedException();
- }
- public function getId()
- {
- return $this->primaryKey;
- }
- public function getAuthKey()
- {
- return sprintf('auth-key-%d', $this->id);
- }
- public function validateAuthKey($authKey)
- {
- return $this->getAuthKey() === $authKey;
- }
- }
|