This commit is contained in:
2026-08-15 03:14:56 +08:00
parent a34133cce5
commit 2a3c55bb53
71 changed files with 1445 additions and 1076 deletions
+23
View File
@@ -2,6 +2,7 @@ package biz
import (
"context"
"errors"
"io"
"time"
)
@@ -68,6 +69,28 @@ type IssuedToken struct {
TTL time.Duration
}
type AuthClaims struct {
UUID string
ID uint
Username string
NickName string
AuthorityID uint
BufferTime time.Duration
MustChangePwd bool
Issuer string
ExpiresAt time.Time
}
var (
ErrTokenExpired = errors.New("token expired")
ErrTokenMalformed = errors.New("token malformed")
ErrTokenSignatureInvalid = errors.New("token signature invalid")
ErrTokenNotValidYet = errors.New("token not valid yet")
ErrTokenInvalid = errors.New("token invalid")
ErrTokenDisabled = errors.New("token disabled")
)
type TokenIssuer interface {
IssueToken(*User, uint, bool, time.Duration) (*IssuedToken, error)
ParseToken(string) (*AuthClaims, error)
}