auth repository

runphp 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
database 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
src 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
.gitignore 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
LICENSE feed385be4 Initial commit 7 mesiacov pred
README.md 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
command.php 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
composer.json 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
config.php 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred
info.php 361ff44d10 feat(auth): 添加认证模块 7 mesiacov pred

README.md

Auth 模块说明

Auth 模块是 SixShop 的权限管理模块,用于管理用户、角色、权限等。

接口

AuthInterface 生成token和验证token

interface AuthInterface
{
    /**
     * 用户ID生成token
     */
    public function generateToken(string $userId): string;

    /**
     * 验证token是否有效,并返回用户ID
     */
    public function verifyToken(string $jwt): string;

    /**
     * 刷新token,返回新的token
     */
    public function refreshToken(string $jwt): string;

    /**
     * 注销token
     */
    public function revokeToken(string $jwt): void;
    
    /**
     * 获取用户类型
     */
    public function getUserType(): UserTypeEnum;
}

HOOKS

  1. token_verify: token验证触发
  2. token_revoke: token注销触发