six-shop/auth

认证模块

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:sixshop-extension

v0.1.2 2025-08-27 02:58 UTC

This package is auto-updated.

Last update: 2025-08-27 08:26:18 UTC


README

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注销触发