Versions in this module Expand all Collapse all v0 v0.1.5 Nov 26, 2025 Changes in this version + const EventAll + const EventCreateSession + const EventDestroySession + const EventDisable + const EventKickout + const EventLogin + const EventLogout + const EventPermissionCheck + const EventRenew + const EventRoleCheck + const EventUntie + const GrantTypeAuthorizationCode + const GrantTypeClientCredentials + const GrantTypePassword + const GrantTypeRefreshToken + const TagSaCheckDisable + const TagSaCheckLogin + const TagSaCheckPermission + const TagSaCheckRole + const TagSaIgnore + const TokenStyleHash + const TokenStyleJWT + const TokenStyleRandom128 + const TokenStyleRandom32 + const TokenStyleRandom64 + const TokenStyleSimple + const TokenStyleTik + const TokenStyleTimestamp + const TokenStyleUUID + const Version + var ContainsString = core.ContainsString + var DefaultString = core.DefaultString + var IsEmpty = core.IsEmpty + var IsNotEmpty = core.IsNotEmpty + var MatchPattern = core.MatchPattern + var MergeStrings = core.MergeStrings + var RandomString = core.RandomString + var RemoveString = core.RemoveString + var UniqueStrings = core.UniqueStrings + func CheckDisable() gin.HandlerFunc + func CheckDisableByToken(tokenValue string) error + func CheckLogin() gin.HandlerFunc + func CheckLoginByToken(tokenValue string) error + func CheckPermission(perms ...string) gin.HandlerFunc + func CheckPermissionAndByToken(tokenValue string, permissions []string) error + func CheckPermissionByToken(tokenValue string, permission string) error + func CheckPermissionOrByToken(tokenValue string, permissions []string) error + func CheckRole(roles ...string) gin.HandlerFunc + func CheckRoleAndByToken(tokenValue string, roles []string) error + func CheckRoleByToken(tokenValue string, role string) error + func CheckRoleOrByToken(tokenValue string, roles []string) error + func Disable(loginID interface{}, duration time.Duration) error + func GenerateNonce() (string, error) + func GetDisableTime(loginID interface{}) (int64, error) + func GetHandler(handler interface{}, annotations ...*Annotation) gin.HandlerFunc + func GetLoginID(tokenValue string) (string, error) + func GetLoginIDNotCheck(tokenValue string) (string, error) + func GetPermissionListByToken(tokenValue string) ([]string, error) + func GetRoleListByToken(tokenValue string) ([]string, error) + func GetSaToken(c *gin.Context) (*core.SaTokenContext, bool) + func GetTokenValue(loginID interface{}, device ...string) (string, error) + func HasPermission(loginID interface{}, permission string) bool + func HasRole(loginID interface{}, role string) bool + func Ignore() gin.HandlerFunc + func IsDisable(loginID interface{}) bool + func IsLogin(tokenValue string) bool + func Kickout(loginID interface{}, device ...string) error + func Login(loginID interface{}, device ...string) (string, error) + func LoginByToken(loginID interface{}, tokenValue string, device ...string) error + func Logout(loginID interface{}, device ...string) error + func LogoutByToken(tokenValue string) error + func Middleware(annotations ...*Annotation) gin.HandlerFunc + func NewGinContext(c *gin.Context) adapter.RequestContext + func ProcessStructAnnotations(handler interface{}) gin.HandlerFunc + func RevokeRefreshToken(refreshToken string) error + func SetManager(mgr *Manager) + func Untie(loginID interface{}) error + func UseStorage(storage Storage, cfg *Config) + func UseStorageProvider(provider StorageProvider, cfg *Config) + func VerifyNonce(nonce string) bool + func WithAnnotation(ann *Annotation) gin.HandlerFunc + type Annotation struct + CheckDisable bool + CheckLogin bool + CheckPermission []string + CheckRole []string + Ignore bool + func ParseTag(tag string) *Annotation + func (a *Annotation) Validate() bool + type Builder = core.Builder + func NewBuilder() *Builder + type Config = core.Config + func DefaultConfig() *Config + type CookieConfig = core.CookieConfig + type Event = core.Event + type EventData = core.EventData + type EventListener = core.EventListener + type EventManager = core.EventManager + func NewEventManager() *EventManager + type GinContext struct + func (g *GinContext) Abort() + func (g *GinContext) Get(key string) (interface{}, bool) + func (g *GinContext) GetBody() ([]byte, error) + func (g *GinContext) GetClientIP() string + func (g *GinContext) GetCookie(key string) string + func (g *GinContext) GetHeader(key string) string + func (g *GinContext) GetHeaders() map[string][]string + func (g *GinContext) GetMethod() string + func (g *GinContext) GetPath() string + func (g *GinContext) GetPostForm(key string) string + func (g *GinContext) GetQuery(key string) string + func (g *GinContext) GetQueryAll() map[string][]string + func (g *GinContext) GetString(key string) string + func (g *GinContext) GetURL() string + func (g *GinContext) GetUserAgent() string + func (g *GinContext) IsAborted() bool + func (g *GinContext) MustGet(key string) any + func (g *GinContext) Set(key string, value interface{}) + func (g *GinContext) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool) + func (g *GinContext) SetCookieWithOptions(options *adapter.CookieOptions) + func (g *GinContext) SetHeader(key, value string) + type HandlerWithAnnotations struct + Annotations []*Annotation + Handler interface{} + func NewHandlerWithAnnotations(handler interface{}, annotations ...*Annotation) *HandlerWithAnnotations + func (h *HandlerWithAnnotations) ToGinHandler() gin.HandlerFunc + type ListenerConfig = core.ListenerConfig + type ListenerFunc = core.ListenerFunc + type Manager = core.Manager + func GetManager() *Manager + func NewManager(storage Storage, cfg *Config) *Manager + type NonceManager = core.NonceManager + func NewNonceManager(storage Storage, prefix string, ttl ...int64) *NonceManager + type OAuth2AccessToken = core.OAuth2AccessToken + type OAuth2Client = core.OAuth2Client + type OAuth2GrantType = core.OAuth2GrantType + type OAuth2Server = core.OAuth2Server + func GetOAuth2Server() *OAuth2Server + func NewOAuth2Server(storage Storage, prefix string) *OAuth2Server + type Plugin struct + ValidateCredentials func(username, password string) error + func NewPlugin(manager *core.Manager) *Plugin + func (p *Plugin) AuthMiddleware() gin.HandlerFunc + func (p *Plugin) LoginHandler(c *gin.Context) + func (p *Plugin) LogoutHandler(c *gin.Context) + func (p *Plugin) PermissionRequired(permission string) gin.HandlerFunc + func (p *Plugin) RoleRequired(role string) gin.HandlerFunc + func (p *Plugin) UserInfoHandler(c *gin.Context) + type RefreshTokenInfo = core.RefreshTokenInfo + func LoginWithRefreshToken(loginID interface{}, device ...string) (*RefreshTokenInfo, error) + func RefreshAccessToken(refreshToken string) (*RefreshTokenInfo, error) + type RefreshTokenManager = core.RefreshTokenManager + func NewRefreshTokenManager(storage Storage, prefix string, cfg *Config) *RefreshTokenManager + type RequestContext = core.RequestContext + type SaTokenContext = core.SaTokenContext + func NewContext(ctx RequestContext, mgr *Manager) *SaTokenContext + type Session = core.Session + func GetSession(loginID interface{}) (*Session, error) + func GetSessionByToken(tokenValue string) (*Session, error) + func GetTokenSession(tokenValue string) (*Session, error) + func LoadSession(id string, storage Storage, prefix string) (*Session, error) + func NewSession(id string, storage Storage, prefix string) *Session + type Storage = core.Storage + type StorageProvider interface + Provide func() Storage + type StorageProviderFunc func() Storage + func (f StorageProviderFunc) Provide() Storage + type TokenGenerator = core.TokenGenerator + func NewTokenGenerator(cfg *Config) *TokenGenerator + type TokenInfo = core.TokenInfo + func GetTokenInfo(tokenValue string) (*TokenInfo, error) + type TokenStyle = core.TokenStyle