Documentation
¶
Overview ¶
@Author daixk 2025/12/22 15:56:00
@Author daixk 2025/12/22 15:56:00
@Author daixk 2025/12/22 15:56:00
@Author daixk 2025/12/22 15:56:00
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2025/12/22 15:56:00
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2026/06/05
@Author daixk 2025/12/22 15:56:00
@Author daixk 2025/12/22 15:56:00
@Author daixk 2025/12/22 15:56:00
@Author daixk 2025/12/22 15:56:00
Index ¶
- Constants
- Variables
- func AccessMiddleware(opts ...AuthOption) func(http.Handler) http.Handler
- func AddPermissionsByCtx(ctx context.Context, permissions []string) error
- func AddRolesByCtx(ctx context.Context, roles []string) error
- func AuthGroup(group chiRouter.Router, opts ...AuthOption) chiRouter.Router
- func AuthMiddleware(opts ...AuthOption) func(http.Handler) http.Handler
- func CheckAllHandler(roles []string, perms []string) http.HandlerFunc
- func CheckDisableByCtx(ctx context.Context) error
- func CheckDisableDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string) error
- func CheckDisableDeviceByCtx(ctx context.Context, device string) error
- func CheckDisableHandler(authType ...string) http.HandlerFunc
- func CheckDisableServiceByCtx(ctx context.Context, services ...string) error
- func CheckDisableServiceLevelByCtx(ctx context.Context, service string, level int) error
- func CheckLoginAndPermissionHandler(perms ...string) http.HandlerFunc
- func CheckLoginAndRoleHandler(roles ...string) http.HandlerFunc
- func CheckLoginByCtx(ctx context.Context) error
- func CheckLoginHandler(authType ...string) http.HandlerFunc
- func CheckPermissionByCtx(ctx context.Context, permission string) error
- func CheckPermissionHandler(perms ...string) http.HandlerFunc
- func CheckPermissionHandlerWithAuthType(authType string, perms ...string) http.HandlerFunc
- func CheckPermissionsAndByCtx(ctx context.Context, permissions []string) error
- func CheckPermissionsOrByCtx(ctx context.Context, permissions []string) error
- func CheckRoleByCtx(ctx context.Context, role string) error
- func CheckRoleHandler(roles ...string) http.HandlerFunc
- func CheckRoleHandlerWithAuthType(authType string, roles ...string) http.HandlerFunc
- func CheckRolesAndByCtx(ctx context.Context, roles []string) error
- func CheckRolesOrByCtx(ctx context.Context, roles []string) error
- func ClearTokenCookieByCtx(ctx context.Context) error
- func ConfirmShortKeyByCtx(ctx context.Context, key string, opts shortkey.ConfirmOptions) (*shortkey.ShortKey, error)
- func ConfirmShortKeyForCurrentLoginByCtx(ctx context.Context, key string, opts shortkey.ConfirmOptions) (*shortkey.ShortKey, error)
- func ConsumeShortKeyByCtx(ctx context.Context, key string, opts ...shortkey.ValidateOptions) (*shortkey.ConsumeResult, error)
- func ConsumeTicketByCtx(ctx context.Context, ticketValue string, opts ...ticket.ValidateOptions) (*ticket.ConsumeResult, error)
- func CreateShortKeyByCtx(ctx context.Context, opts shortkey.CreateOptions) (*shortkey.ShortKey, error)
- func CreateShortKeyWithTimeoutByCtx(ctx context.Context, opts shortkey.CreateOptions, timeout time.Duration) (*shortkey.ShortKey, error)
- func CreateTicketByCtx(ctx context.Context, opts ticket.CreateOptions) (*ticket.Ticket, error)
- func CreateTicketForCurrentLoginByCtx(ctx context.Context, opts ticket.CreateOptions) (*ticket.Ticket, error)
- func CreateTicketWithTimeoutByCtx(ctx context.Context, opts ticket.CreateOptions, timeout time.Duration) (*ticket.Ticket, error)
- func DeleteSessionValueByCtx(ctx context.Context, key string) error
- func DisableByCtx(ctx context.Context, duration time.Duration, reason ...string) error
- func DisableDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string, duration time.Duration, ...) error
- func DisableDeviceByCtx(ctx context.Context, device string, duration time.Duration, reason ...string) error
- func DisableServiceByCtx(ctx context.Context, service string, duration time.Duration, reason ...string) error
- func DisableServiceLevelByCtx(ctx context.Context, service string, level int, duration time.Duration, ...) error
- func ExchangeOAuth2CodeForTokenByCtx(ctx context.Context, code, clientID, clientSecret, redirectURI string) (*oauth2.AccessToken, error)
- func ExchangeOAuth2CodeForTokenWithPKCEByCtx(ctx context.Context, ...) (*oauth2.AccessToken, error)
- func ForEachTerminalByCtx(ctx context.Context, visitor manager.TerminalVisitor) error
- func ForEachTerminalByDeviceByCtx(ctx context.Context, device string, visitor manager.TerminalVisitor) error
- func GenerateNonceByCtx(ctx context.Context) (string, error)
- func GenerateNonceWithTimeoutByCtx(ctx context.Context, timeout time.Duration) (string, error)
- func GenerateOAuth2AuthorizationCodeByCtx(ctx context.Context, clientID, userID, redirectURI string, scopes []string) (*oauth2.AuthorizationCode, error)
- func GenerateOAuth2AuthorizationCodeWithPKCEByCtx(ctx context.Context, clientID, userID, redirectURI string, scopes []string, ...) (*oauth2.AuthorizationCode, error)
- func GetDTokenContext(r *http.Request) (*DContext.DTokenContext, bool)
- func GetDTokenContextByCtx(ctx context.Context) (*DContext.DTokenContext, bool)
- func GetDeviceByCtx(ctx context.Context) (string, error)
- func GetDeviceIDByCtx(ctx context.Context) (string, error)
- func GetDisableDeviceAndDeviceIDInfoByCtx(ctx context.Context, device, deviceId string) (*manager.DeviceDisableInfo, error)
- func GetDisableDeviceAndDeviceIDTTLByCtx(ctx context.Context, device, deviceId string) (int64, error)
- func GetDisableDeviceInfoByCtx(ctx context.Context, device string) (*manager.DeviceDisableInfo, error)
- func GetDisableDeviceTTLByCtx(ctx context.Context, device string) (int64, error)
- func GetDisableInfoByCtx(ctx context.Context) (*manager.DisableInfo, error)
- func GetDisableServiceInfoByCtx(ctx context.Context, service string) (*manager.ServiceDisableInfo, error)
- func GetDisableServiceTTLByCtx(ctx context.Context, service string) (int64, error)
- func GetDisableTTLByCtx(ctx context.Context) (int64, error)
- func GetHandler(handler http.HandlerFunc, annotations ...*Annotation) http.HandlerFunc
- func GetLatestTokenValueByCtx(ctx context.Context, device ...string) (string, error)
- func GetLoginIDByCtx(ctx context.Context) (string, error)
- func GetLoginIDFromRequest(w http.ResponseWriter, r *http.Request, authType ...string) (string, error)
- func GetManagerByCtx(ctx context.Context) (*manager.Manager, error)
- func GetNonceTTLByCtx(ctx context.Context, nonce string) (int64, error)
- func GetOAuth2ClientByCtx(ctx context.Context, clientID string) (*oauth2.Client, error)
- func GetOnlineTerminalCountByCtx(ctx context.Context) (int, error)
- func GetOnlineTerminalCountByDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string) (int, error)
- func GetOnlineTerminalCountByDeviceByCtx(ctx context.Context, device string) (int, error)
- func GetPermissionsByCtx(ctx context.Context) ([]string, error)
- func GetPermissionsByTokenByCtx(ctx context.Context) ([]string, error)
- func GetRefreshTokenTTLByCtx(ctx context.Context, refreshToken string) (int64, error)
- func GetRequestContextByCtx(ctx context.Context) (adapter.RequestContext, error)
- func GetRolesByCtx(ctx context.Context) ([]string, error)
- func GetRolesByTokenByCtx(ctx context.Context) ([]string, error)
- func GetSessionByCtx(ctx context.Context) (*manager.Session, error)
- func GetSessionByTokenByCtx(ctx context.Context) (*manager.Session, error)
- func GetSessionValueByCtx(ctx context.Context, key string) (any, bool, error)
- func GetShortKeyStatusByCtx(ctx context.Context, key string) (shortkey.Status, error)
- func GetShortKeyTTLByCtx(ctx context.Context, key string) (int64, error)
- func GetTerminalInfoByCtx(ctx context.Context) (*manager.TerminalInfo, error)
- func GetTerminalListByCtx(ctx context.Context, device ...string) ([]manager.TerminalInfo, error)
- func GetTicketStatusByCtx(ctx context.Context, ticketValue string) (ticket.Status, error)
- func GetTicketTTLByCtx(ctx context.Context, ticketValue string) (int64, error)
- func GetTokenCreateTimeByCtx(ctx context.Context) (int64, error)
- func GetTokenFromRequest(w http.ResponseWriter, r *http.Request, authType ...string) string
- func GetTokenInfoByCtx(ctx context.Context) (*manager.TokenInfo, error)
- func GetTokenTTLByCtx(ctx context.Context) (int64, error)
- func GetTokenValueByCtx(ctx context.Context) (string, error)
- func GetTokenValueListByCtx(ctx context.Context, checkAlive ...bool) ([]string, error)
- func GetTokenValueListByDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string, checkAlive ...bool) ([]string, error)
- func GetTokenValueListByDeviceByCtx(ctx context.Context, device string, checkAlive ...bool) ([]string, error)
- func HasPermissionByCtx(ctx context.Context, permission string) bool
- func HasPermissionsAndByCtx(ctx context.Context, permissions []string) bool
- func HasPermissionsByCtx(ctx context.Context, permissions []string) bool
- func HasPermissionsOrByCtx(ctx context.Context, permissions []string) bool
- func HasRoleByCtx(ctx context.Context, role string) bool
- func HasRolesAndByCtx(ctx context.Context, roles []string) bool
- func HasRolesByCtx(ctx context.Context, roles []string) bool
- func HasRolesOrByCtx(ctx context.Context, roles []string) bool
- func IgnoreHandler() http.HandlerFunc
- func IntrospectTokenByCtx(ctx context.Context) (*manager.TokenIntrospection, error)
- func IsDisableByCtx(ctx context.Context) bool
- func IsDisableDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string) bool
- func IsDisableDeviceByCtx(ctx context.Context, device string) bool
- func IsDisableServiceByCtx(ctx context.Context, service string) bool
- func IsDisableServiceLevelByCtx(ctx context.Context, service string, level int) bool
- func IsLoginByCtx(ctx context.Context) bool
- func IsLoginFromRequest(w http.ResponseWriter, r *http.Request, authType ...string) bool
- func IsValidNonceByCtx(ctx context.Context, nonce string) bool
- func KickoutByCtx(ctx context.Context) error
- func KickoutByDeviceAndDeviceIDByCtx(ctx context.Context, deviceAndDeviceId ...string) error
- func KickoutByDeviceByCtx(ctx context.Context, device string) error
- func KickoutByLoginIDByCtx(ctx context.Context) error
- func LoginByCtx(ctx context.Context, loginID string, deviceAndDeviceId ...string) (string, error)
- func LoginByTokenByCtx(ctx context.Context) error
- func LoginWithCookieByCtx(ctx context.Context, loginID string, deviceAndDeviceId ...string) (string, error)
- func LoginWithCookieOptionsByCtx(ctx context.Context, opts manager.LoginOptions) (string, error)
- func LoginWithCookieTimeoutByCtx(ctx context.Context, loginID string, timeout time.Duration, ...) (string, error)
- func LoginWithOptionsByCtx(ctx context.Context, opts manager.LoginOptions) (string, error)
- func LoginWithRefreshTokenByCtx(ctx context.Context, loginID string, deviceAndDeviceId ...string) (*manager.RefreshTokenPair, error)
- func LoginWithRefreshTokenOptionsByCtx(ctx context.Context, opts manager.RefreshTokenOptions) (*manager.RefreshTokenPair, error)
- func LoginWithTimeoutByCtx(ctx context.Context, loginID string, timeout time.Duration, ...) (string, error)
- func LogoutByCtx(ctx context.Context) error
- func LogoutByDeviceAndDeviceIdByCtx(ctx context.Context, deviceAndDeviceId ...string) error
- func LogoutByDeviceByCtx(ctx context.Context, device string) error
- func LogoutByLoginIDByCtx(ctx context.Context) error
- func LogoutWithCookieByCtx(ctx context.Context) error
- func NewBuilder() *builder.Builder
- func NewChiContext(w http.ResponseWriter, r *http.Request) adapter.RequestContext
- func OAuth2ClientCredentialsTokenByCtx(ctx context.Context, clientID, clientSecret string, scopes []string) (*oauth2.AccessToken, error)
- func OAuth2PasswordGrantTokenByCtx(ctx context.Context, clientID, clientSecret, username, password string, ...) (*oauth2.AccessToken, error)
- func OAuth2TokenByCtx(ctx context.Context, req *oauth2.TokenRequest, ...) (*oauth2.AccessToken, error)
- func PermissionGroup(group chiRouter.Router, perms []string, opts ...AuthOption) chiRouter.Router
- func PermissionMiddleware(permissions []string, opts ...AuthOption) func(http.Handler) http.Handler
- func PermissionPathMiddleware(permissions []string, opts ...AuthOption) func(http.Handler) http.Handler
- func RefreshOAuth2AccessTokenByCtx(ctx context.Context, clientID, refreshToken, clientSecret string) (*oauth2.AccessToken, error)
- func RefreshTokenByCtx(ctx context.Context, refreshToken string) (*manager.RefreshTokenPair, error)
- func RegisterDTokenContextMiddleware(opts ...AuthOption) func(http.Handler) http.Handler
- func RegisterOAuth2ClientByCtx(ctx context.Context, client *oauth2.Client) error
- func RemovePermissionsByCtx(ctx context.Context, permissions []string) error
- func RemoveRolesByCtx(ctx context.Context, roles []string) error
- func RenewTimeoutByCtx(ctx context.Context, timeout time.Duration) error
- func ReplaceByCtx(ctx context.Context) error
- func ReplaceByDeviceAndDeviceIDByCtx(ctx context.Context, deviceAndDeviceId ...string) error
- func ReplaceByDeviceByCtx(ctx context.Context, device string) error
- func ReplaceByLoginIDByCtx(ctx context.Context) error
- func RevokeOAuth2TokenByCtx(ctx context.Context, accessToken string) error
- func RevokeRefreshTokenByCtx(ctx context.Context, refreshToken string) error
- func RevokeShortKeyByCtx(ctx context.Context, key string) error
- func RevokeTicketByCtx(ctx context.Context, ticketValue string) error
- func RoleAndPermissionGroup(group chiRouter.Router, roles []string, perms []string, opts ...AuthOption) chiRouter.Router
- func RoleGroup(group chiRouter.Router, roles []string, opts ...AuthOption) chiRouter.Router
- func RoleMiddleware(roles []string, opts ...AuthOption) func(http.Handler) http.Handler
- func SearchSessionIDByCtx(ctx context.Context, keyword string, start, size int) ([]string, error)
- func SearchTokenValueByCtx(ctx context.Context, keyword string, start, size int) ([]string, error)
- func SetSessionValueByCtx(ctx context.Context, key string, value any) error
- func SetTokenCookieByCtx(ctx context.Context, token string) error
- func TerminateByCtx(ctx context.Context, opts manager.TerminateOptions) error
- func UnregisterOAuth2ClientByCtx(ctx context.Context, clientID string) error
- func UntieByCtx(ctx context.Context) error
- func UntieDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string) error
- func UntieDeviceByCtx(ctx context.Context, device string) error
- func UntieServiceByCtx(ctx context.Context, service string) error
- func ValidateOAuth2AccessTokenAndGetInfoByCtx(ctx context.Context, accessToken string) (*oauth2.AccessToken, error)
- func ValidateOAuth2AccessTokenByCtx(ctx context.Context, accessToken string) bool
- func ValidateShortKeyByCtx(ctx context.Context, key string, opts ...shortkey.ValidateOptions) (*shortkey.ShortKey, error)
- func ValidateTicketByCtx(ctx context.Context, ticketValue string, opts ...ticket.ValidateOptions) (*ticket.Ticket, error)
- func VerifyAndConsumeNonceByCtx(ctx context.Context, nonce string) error
- func VerifyNonceByCtx(ctx context.Context, nonce string) bool
- func WithContext(r *http.Request, authType ...string) context.Context
- type AccessProvider
- type AccessProviderFunc
- type AccessSubject
- type AccessToken
- type AdminStorage
- type Annotation
- type AtomicStorage
- type Auth
- type AuthHandleRequest
- type AuthOption
- func WithAuthType(authType string) AuthOption
- func WithBeforeAuthHandler(fn BeforeAuthHandler) AuthOption
- func WithFailFunc(fn func(w http.ResponseWriter, r *http.Request, err error)) AuthOption
- func WithLogicType(logicType LogicType) AuthOption
- func WithRouteAccessHandler(fn RouteAccessHandler) AuthOption
- type AuthOptions
- type AuthorizationCode
- type Base64Serializer
- type BeforeAuthHandler
- type Builder
- type ChiContext
- func (c *ChiContext) Abort()
- func (c *ChiContext) Get(key string) (interface{}, bool)
- func (c *ChiContext) GetBody() ([]byte, error)
- func (c *ChiContext) GetClientIP() string
- func (c *ChiContext) GetCookie(key string) string
- func (c *ChiContext) GetHeader(key string) string
- func (c *ChiContext) GetHeaders() map[string][]string
- func (c *ChiContext) GetMethod() string
- func (c *ChiContext) GetPath() string
- func (c *ChiContext) GetPostForm(key string) string
- func (c *ChiContext) GetQuery(key string) string
- func (c *ChiContext) GetQueryAll() map[string][]string
- func (c *ChiContext) GetRawRequest() *http.Request
- func (c *ChiContext) GetRawResponseWriter() http.ResponseWriter
- func (c *ChiContext) GetString(key string) string
- func (c *ChiContext) GetURL() string
- func (c *ChiContext) GetUserAgent() string
- func (c *ChiContext) IsAborted() bool
- func (c *ChiContext) IsTLS() bool
- func (c *ChiContext) JSON(code int, v any) error
- func (c *ChiContext) MustGet(key string) any
- func (c *ChiContext) Set(key string, value interface{})
- func (c *ChiContext) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool)
- func (c *ChiContext) SetCookieWithOptions(options *adapter.CookieOptions)
- func (c *ChiContext) SetHeader(key, value string)
- func (c *ChiContext) SetStatusCode(code int)
- func (c *ChiContext) Write(data []byte) (int, error)
- type Codec
- type CodecFactory
- type ComponentFactories
- type Components
- type ConcurrencyScope
- type Config
- type CookieConfig
- type CookieOptions
- type DTokenBuilder
- type DTokenContext
- type DTokenError
- type DefaultGenerator
- type DeviceDisableInfo
- type DeviceDisableOptions
- type DisableInfo
- type DisableOptions
- type Event
- type EventData
- type EventFilter
- type EventManager
- type EventStats
- type FullStorage
- type Generator
- type GeneratorFactory
- type GrantType
- type JSONSerializer
- type Listener
- type ListenerConfig
- type ListenerFunc
- type Log
- type LogControl
- type LogFactory
- type LogLevel
- type Logger
- type LoggerConfig
- type LogicType
- type LoginOptions
- type LogoutMode
- type LogoutOptions
- type Manager
- type ManagerOption
- type ManagerRefreshTokenOptions
- type MemoryStorage
- type MsgPackSerializer
- type NonceConfig
- type NonceManager
- type NopLogger
- type OAuth2Client
- type OAuth2Config
- type OAuth2Server
- type PermissionOptions
- type Pool
- type PoolFactory
- type RedisConfig
- type RedisStorage
- type RefreshTokenInfo
- type RefreshTokenOptions
- type RefreshTokenPair
- type RenewPoolConfig
- type RenewPoolManager
- type ReplacedLoginExitMode
- type ReplacedLoginMode
- type RequestContext
- type RequestContextExt
- type RoleOptions
- type RouteAccessHandler
- type RouteAccessRequest
- type SameSiteMode
- type ScannerStorage
- type ServiceDisableInfo
- type ServiceDisableOptions
- type Session
- type Storage
- type StorageFactory
- type TerminalInfo
- type TerminalRemovalFunc
- type TerminalVisitor
- type TokenInfo
- type TokenIntrospection
- type TokenRequest
- type TokenState
- type TokenStyle
- type UserValidator
Constants ¶
const ( Version = corepkg.Version SameSiteStrict = config.SameSiteStrict SameSiteLax = config.SameSiteLax SameSiteNone = config.SameSiteNone ConcurrencyScopeAccount = config.ConcurrencyScopeAccount ConcurrencyScopeDevice = config.ConcurrencyScopeDevice ReplacedLoginModeOldDevice = config.ReplacedLoginExitModeOldDevice ReplacedLoginModeNewDevice = config.ReplacedLoginExitModeNewDevice ReplacedLoginExitModeOldDevice = config.ReplacedLoginExitModeOldDevice ReplacedLoginExitModeNewDevice = config.ReplacedLoginExitModeNewDevice LogoutModeLogout = config.LogoutModeLogout LogoutModeKickout = config.LogoutModeKickout LogoutModeReplaced = config.LogoutModeReplaced DefaultTokenName = config.DefaultTokenName DefaultKeyPrefix = config.DefaultKeyPrefix DefaultAuthType = config.DefaultAuthType TokenKeyPrefix = config.TokenKeyPrefix DefaultTimeout = config.DefaultTimeout DefaultRefreshTokenTimeout = config.DefaultRefreshTokenTimeout DefaultJWTSecretKey = config.DefaultJWTSecretKey DefaultMaxLoginCount = config.DefaultMaxLoginCount DefaultCookiePath = config.DefaultCookiePath NoLimit = config.NoLimit DefaultNonceTTL = nonce.DefaultNonceTTL NonceLength = nonce.NonceLength NonceKeySuffix = nonce.NonceKeySuffix DefaultAccessTTL = nonce.DefaultAccessTTL TokenStyleUUID = adapter.TokenStyleUUID TokenStyleSimple = adapter.TokenStyleSimple TokenStyleRandom32 = adapter.TokenStyleRandom32 TokenStyleRandom64 = adapter.TokenStyleRandom64 TokenStyleRandom128 = adapter.TokenStyleRandom128 TokenStyleJWT = adapter.TokenStyleJWT TokenStyleHash = adapter.TokenStyleHash TokenStyleTimestamp = adapter.TokenStyleTimestamp TokenStyleTik = adapter.TokenStyleTik LogLevelDebug = adapter.LogLevelDebug LogLevelInfo = adapter.LogLevelInfo LogLevelWarn = adapter.LogLevelWarn LogLevelError = adapter.LogLevelError EventLogin = listener.EventLogin EventLogout = listener.EventLogout EventKickout = listener.EventKickout EventReplace = listener.EventReplace EventDisable = listener.EventDisable EventUntie = listener.EventUntie EventRenew = listener.EventRenew EventCreateSession = listener.EventCreateSession EventDestroySession = listener.EventDestroySession EventPermissionCheck = listener.EventPermissionCheck EventPermissionChange = listener.EventPermissionChange EventRoleCheck = listener.EventRoleCheck EventRoleChange = listener.EventRoleChange EventDisableService = listener.EventDisableService EventUntieService = listener.EventUntieService EventDisableDevice = listener.EventDisableDevice EventUntieDevice = listener.EventUntieDevice EventRefreshTokenCreate = listener.EventRefreshTokenCreate EventRefreshTokenRotate = listener.EventRefreshTokenRotate EventRefreshTokenRevoke = listener.EventRefreshTokenRevoke EventNonceGenerate = listener.EventNonceGenerate EventNonceVerify = listener.EventNonceVerify EventTicketCreate = listener.EventTicketCreate EventTicketValidate = listener.EventTicketValidate EventTicketConsume = listener.EventTicketConsume EventTicketRevoke = listener.EventTicketRevoke EventShortKeyCreate = listener.EventShortKeyCreate EventShortKeyConfirm = listener.EventShortKeyConfirm EventShortKeyValidate = listener.EventShortKeyValidate EventShortKeyConsume = listener.EventShortKeyConsume EventShortKeyRevoke = listener.EventShortKeyRevoke EventOAuth2ClientRegister = listener.EventOAuth2ClientRegister EventOAuth2ClientUnregister = listener.EventOAuth2ClientUnregister EventOAuth2CodeGenerate = listener.EventOAuth2CodeGenerate EventOAuth2TokenIssue = listener.EventOAuth2TokenIssue EventOAuth2TokenRefresh = listener.EventOAuth2TokenRefresh EventOAuth2TokenValidate = listener.EventOAuth2TokenValidate EventOAuth2TokenRevoke = listener.EventOAuth2TokenRevoke EventAll = listener.EventAll ExtraKeyPermission = listener.ExtraKeyPermission ExtraKeyPermissions = listener.ExtraKeyPermissions ExtraKeyRole = listener.ExtraKeyRole ExtraKeyRoles = listener.ExtraKeyRoles ExtraKeyLogic = listener.ExtraKeyLogic ExtraKeyResult = listener.ExtraKeyResult ExtraKeyAction = listener.ExtraKeyAction ExtraKeyService = listener.ExtraKeyService ExtraKeyLevel = listener.ExtraKeyLevel ExtraKeyTokenType = listener.ExtraKeyTokenType ExtraKeyClientID = listener.ExtraKeyClientID ExtraKeyUserID = listener.ExtraKeyUserID ExtraKeyScopes = listener.ExtraKeyScopes ExtraKeySource = listener.ExtraKeySource ExtraKeySourceApp = listener.ExtraKeySourceApp ExtraKeyTargetApp = listener.ExtraKeyTargetApp ExtraKeyScene = listener.ExtraKeyScene ExtraKeyStatus = listener.ExtraKeyStatus ExtraKeyTTL = listener.ExtraKeyTTL ExtraKeyRefreshToken = listener.ExtraKeyRefreshToken ExtraKeyGrantType = listener.ExtraKeyGrantType EventLogicAnd = listener.LogicAnd EventLogicOr = listener.LogicOr ActionAdd = listener.ActionAdd ActionRemove = listener.ActionRemove ActionCreate = listener.ActionCreate ActionValidate = listener.ActionValidate ActionConsume = listener.ActionConsume ActionRevoke = listener.ActionRevoke ActionConfirm = listener.ActionConfirm ActionRotate = listener.ActionRotate ActionRegister = listener.ActionRegister ActionUnregister = listener.ActionUnregister ActionIssue = listener.ActionIssue ActionRefresh = listener.ActionRefresh DisableKeyPrefix = manager.DisableKeyPrefix DisableServiceKeyPrefix = manager.DisableServiceKeyPrefix DisableDeviceKeyPrefix = manager.DisableDeviceKeyPrefix DisableDeviceIDKeyPrefix = manager.DisableDeviceIDKeyPrefix SessionKeyPrefix = manager.SessionKeyPrefix RenewKeyPrefix = manager.RenewKeyPrefix ActivePrefix = manager.ActivePrefix RefreshTokenKeyPrefix = manager.RefreshTokenKeyPrefix TokenRefreshKeyPrefix = manager.TokenRefreshKeyPrefix SessionKeyLoginID = manager.SessionKeyLoginID SessionKeyDevice = manager.SessionKeyDevice SessionKeyLoginTime = manager.SessionKeyLoginTime SessionKeyPermissions = manager.SessionKeyPermissions SessionKeyRoles = manager.SessionKeyRoles PermissionWildcard = manager.PermissionWildcard PermissionSeparator = manager.PermissionSeparator TokenStateLogout = manager.TokenStateLogout TokenStateKickOut = manager.TokenStateKickOut TokenStateReplaced = manager.TokenStateReplaced TokenStateActiveTimeout = manager.TokenStateActiveTimeout DefaultCodeExpiration = oauth2.DefaultCodeExpiration DefaultTokenExpiration = oauth2.DefaultTokenExpiration DefaultRefreshTTL = oauth2.DefaultRefreshTTL CodeLength = oauth2.CodeLength AccessTokenLength = oauth2.AccessTokenLength RefreshTokenLength = oauth2.RefreshTokenLength CodeKeySuffix = oauth2.CodeKeySuffix OAuth2TokenKeySuffix = oauth2.TokenKeySuffix OAuth2RefreshKeySuffix = oauth2.RefreshKeySuffix ClientKeySuffix = oauth2.ClientKeySuffix GrantTypeAuthorizationCode = oauth2.GrantTypeAuthorizationCode GrantTypeRefreshToken = oauth2.GrantTypeRefreshToken GrantTypeClientCredentials = oauth2.GrantTypeClientCredentials GrantTypePassword = oauth2.GrantTypePassword CodeChallengeMethodPlain = oauth2.CodeChallengeMethodPlain CodeChallengeMethodS256 = oauth2.CodeChallengeMethodS256 TokenTypeBearer = oauth2.TokenTypeBearer TTLNoExpire = adapter.TTLNoExpire TTLNotFound = adapter.TTLNotFound )
Common constants forward core configuration values. Common 常量转发核心配置值。 Common 常量转发核心配置值。
const ( CodeSuccess = derror.CodeSuccess CodeBadRequest = derror.CodeBadRequest CodeNotLogin = derror.CodeNotLogin CodePermissionDenied = derror.CodePermissionDenied CodeNotFound = derror.CodeNotFound CodeServerError = derror.CodeServerError CodeTokenInvalid = derror.CodeTokenInvalid CodeTokenExpired = derror.CodeTokenExpired CodeAccountDisabled = derror.CodeAccountDisabled CodeKickedOut = derror.CodeKickedOut CodeActiveTimeout = derror.CodeActiveTimeout CodeMaxLoginCount = derror.CodeMaxLoginCount CodeStorageError = derror.CodeStorageError CodeInvalidParameter = derror.CodeInvalidParameter )
DToken error codes.
Variables ¶
var ( New = dtoken.New Default = dtoken.Default MustDefault = dtoken.MustDefault NewByAuthType = dtoken.NewByAuthType LoginWithOptions = dtoken.LoginWithOptions LoginWithRefreshTokenOptions = dtoken.LoginWithRefreshTokenOptions LogoutWithOptions = dtoken.LogoutWithOptions KickoutWithOptions = dtoken.KickoutWithOptions ReplaceWithOptions = dtoken.ReplaceWithOptions DisableWithOptions = dtoken.DisableWithOptions DisableServiceWithOptions = dtoken.DisableServiceWithOptions DisableDeviceWithOptions = dtoken.DisableDeviceWithOptions AddPermissionsWithOptions = dtoken.AddPermissionsWithOptions RemovePermissionsWithOptions = dtoken.RemovePermissionsWithOptions CheckPermissionWithOptions = dtoken.CheckPermissionWithOptions CheckPermissionsAndWithOptions = dtoken.CheckPermissionsAndWithOptions CheckPermissionsOrWithOptions = dtoken.CheckPermissionsOrWithOptions AddRolesWithOptions = dtoken.AddRolesWithOptions RemoveRolesWithOptions = dtoken.RemoveRolesWithOptions CheckRoleWithOptions = dtoken.CheckRoleWithOptions CheckRolesAndWithOptions = dtoken.CheckRolesAndWithOptions CheckRolesOrWithOptions = dtoken.CheckRolesOrWithOptions )
Instance and typed global operations.
var ( NewDTokenBuilder = dtoken.NewBuilder BuildAndSetManager = dtoken.BuildAndSetManager DefaultConfig = config.DefaultConfig DefaultCookieConfig = config.DefaultCookieConfig NewContext = corecontext.NewContext NewManager = manager.NewManager WithNonceManager = manager.WithNonceManager WithOAuth2Manager = manager.WithOAuth2Manager NewEventManager = listener.NewManager DefaultNonceConfig = nonce.DefaultConfig NewDefaultNonceManager = nonce.NewDefaultNonceManager NewNonceManagerWithConfig = nonce.NewNonceManagerWithConfig NewNonceManager = nonce.NewNonceManager DefaultOAuth2Config = oauth2.DefaultConfig NewDefaultOAuth2Server = oauth2.NewDefaultOAuth2Server NewOAuth2ServerWithConfig = oauth2.NewOAuth2ServerWithConfig NewOAuth2Server = oauth2.NewOAuth2Server NewRedisStorage = redisstorage.NewStorage NewRedisStorageFromConfig = redisstorage.NewStorageFromConfig NewRedisStorageFromClient = redisstorage.NewStorageFromClient NewStorageFromConfig = redisstorage.NewStorageFromConfig NewStorageFromClient = redisstorage.NewStorageFromClient NewMemoryStorage = memorystorage.NewStorage NewJSONSerializer = jsoncodec.NewJSONSerializer NewBase64Serializer = base64codec.NewBase64Serializer NewMsgPackSerializer = msgpackcodec.NewMsgPackSerializer NewDefaultTokenGenerator = dgenerator.NewDefaultGenerator NewTokenGenerator = dgenerator.NewGenerator DefaultLoggerConfig = dlog.DefaultLoggerConfig NewLoggerWithConfig = dlog.NewLoggerWithConfig DefaultRenewPoolConfig = ants.DefaultRenewPoolConfig NewRenewPoolManagerWithDefault = ants.NewRenewPoolManagerWithDefaultConfig NewRenewPoolManagerWithConfig = ants.NewRenewPoolManagerWithConfig NewNopLogger = nop.NewNopLogger NewAdapterNopLogger = adapter.NewNopLogger )
Component constructors forward bundled implementations. Component 构造器转发内置实现。
var ( NewDTokenError = derror.NewDTokenError ErrKeyNotFound = derror.ErrKeyNotFound ErrSerializeFailed = derror.ErrSerializeFailed ErrTypeConvert = derror.ErrTypeConvert ErrManagerNotFound = derror.ErrManagerNotFound ErrManagerInvalidType = derror.ErrManagerInvalidType ErrInvalidParam = derror.ErrInvalidParam ErrStorageCapabilityUnsupported = derror.ErrStorageCapabilityUnsupported ErrIDIsEmpty = derror.ErrIDIsEmpty ErrEmptyLoginID = derror.ErrEmptyLoginID ErrAccountDisabled = derror.ErrAccountDisabled ErrAccountNotDisabled = derror.ErrAccountNotDisabled ErrLoginLimitExceeded = derror.ErrLoginLimitExceeded ErrNotLogin = derror.ErrNotLogin ErrInvalidToken = derror.ErrInvalidToken ErrTokenExpired = derror.ErrTokenExpired ErrActiveTimeout = derror.ErrActiveTimeout ErrTokenKickout = derror.ErrTokenKickout ErrTokenReplaced = derror.ErrTokenReplaced ErrInvalidDevice = derror.ErrInvalidDevice ErrPermissionDenied = derror.ErrPermissionDenied ErrRoleDenied = derror.ErrRoleDenied ErrServiceDisabled = derror.ErrServiceDisabled ErrServiceNotDisabled = derror.ErrServiceNotDisabled ErrDeviceDisabled = derror.ErrDeviceDisabled ErrDeviceNotDisabled = derror.ErrDeviceNotDisabled ErrDisableLevelNotReached = derror.ErrDisableLevelNotReached ErrSessionNotFound = derror.ErrSessionNotFound ErrInvalidNonce = derror.ErrInvalidNonce ErrClientOrClientIDEmpty = derror.ErrClientOrClientIDEmpty ErrClientNotFound = derror.ErrClientNotFound ErrInvalidClientCredentials = derror.ErrInvalidClientCredentials ErrInvalidGrantType = derror.ErrInvalidGrantType ErrInvalidRedirectURI = derror.ErrInvalidRedirectURI ErrInvalidScope = derror.ErrInvalidScope ErrUserIDEmpty = derror.ErrUserIDEmpty ErrInvalidAuthCode = derror.ErrInvalidAuthCode ErrAuthCodeUsed = derror.ErrAuthCodeUsed ErrAuthCodeExpired = derror.ErrAuthCodeExpired ErrClientMismatch = derror.ErrClientMismatch ErrRedirectURIMismatch = derror.ErrRedirectURIMismatch ErrInvalidRefreshToken = derror.ErrInvalidRefreshToken ErrInvalidAccessToken = derror.ErrInvalidAccessToken ErrInvalidUserCredentials = derror.ErrInvalidUserCredentials ErrInvalidCodeVerifier = derror.ErrInvalidCodeVerifier )
DToken error helpers and values.
var ( SetManager = dtoken.SetManager GetManager = dtoken.GetManager GetEventManager = dtoken.GetEventManager DeleteManager = dtoken.DeleteManager DeleteAllManager = dtoken.DeleteAllManager Login = dtoken.Login LoginWithTimeout = dtoken.LoginWithTimeout LoginWithRefreshToken = dtoken.LoginWithRefreshToken RefreshToken = dtoken.RefreshToken RevokeRefreshToken = dtoken.RevokeRefreshToken GetRefreshTokenTTL = dtoken.GetRefreshTokenTTL IntrospectToken = dtoken.IntrospectToken LoginByToken = dtoken.LoginByToken Logout = dtoken.Logout LogoutByDeviceAndDeviceId = dtoken.LogoutByDeviceAndDeviceId LogoutByDevice = dtoken.LogoutByDevice LogoutByLoginID = dtoken.LogoutByLoginID Kickout = dtoken.Kickout Replace = dtoken.Replace KickoutByDeviceAndDeviceId = dtoken.KickoutByDeviceAndDeviceId KickoutByDevice = dtoken.KickoutByDevice KickoutByLoginID = dtoken.KickoutByLoginID ReplaceByDeviceAndDeviceId = dtoken.ReplaceByDeviceAndDeviceId ReplaceByDevice = dtoken.ReplaceByDevice ReplaceByLoginID = dtoken.ReplaceByLoginID IsLogin = dtoken.IsLogin CheckLogin = dtoken.CheckLogin GetLoginID = dtoken.GetLoginID GetTokenInfo = dtoken.GetTokenInfo GetDevice = dtoken.GetDevice GetDeviceId = dtoken.GetDeviceId GetTokenCreateTime = dtoken.GetTokenCreateTime GetTokenTTL = dtoken.GetTokenTTL GetOnlineTerminalCount = dtoken.GetOnlineTerminalCount GetOnlineTerminalCountByDevice = dtoken.GetOnlineTerminalCountByDevice GetOnlineTerminalCountByDeviceAndDeviceId = dtoken.GetOnlineTerminalCountByDeviceAndDeviceId Disable = dtoken.Disable Untie = dtoken.Untie IsDisable = dtoken.IsDisable GetDisableInfo = dtoken.GetDisableInfo GetDisableTTL = dtoken.GetDisableTTL DisableService = dtoken.DisableService DisableServiceWithReason = dtoken.DisableServiceWithReason DisableServiceLevel = dtoken.DisableServiceLevel DisableServiceLevelWithReason = dtoken.DisableServiceLevelWithReason UntieService = dtoken.UntieService IsDisableService = dtoken.IsDisableService IsDisableServiceLevel = dtoken.IsDisableServiceLevel CheckDisableService = dtoken.CheckDisableService CheckDisableServiceLevel = dtoken.CheckDisableServiceLevel GetDisableServiceInfo = dtoken.GetDisableServiceInfo GetDisableServiceTTL = dtoken.GetDisableServiceTTL DisableDevice = dtoken.DisableDevice DisableDeviceWithReason = dtoken.DisableDeviceWithReason DisableDeviceAndDeviceId = dtoken.DisableDeviceAndDeviceId DisableDeviceAndDeviceIdWithReason = dtoken.DisableDeviceAndDeviceIdWithReason UntieDevice = dtoken.UntieDevice UntieDeviceAndDeviceId = dtoken.UntieDeviceAndDeviceId IsDisableDevice = dtoken.IsDisableDevice IsDisableDeviceAndDeviceId = dtoken.IsDisableDeviceAndDeviceId CheckDisableDevice = dtoken.CheckDisableDevice CheckDisableDeviceAndDeviceId = dtoken.CheckDisableDeviceAndDeviceId GetDisableDeviceInfo = dtoken.GetDisableDeviceInfo GetDisableDeviceAndDeviceIdInfo = dtoken.GetDisableDeviceAndDeviceIdInfo GetDisableDeviceTTL = dtoken.GetDisableDeviceTTL GetDisableDeviceAndDeviceIdTTL = dtoken.GetDisableDeviceAndDeviceIdTTL CheckPermission = dtoken.CheckPermission CheckPermissionAnd = dtoken.CheckPermissionAnd CheckPermissionOr = dtoken.CheckPermissionOr CheckRole = dtoken.CheckRole CheckRoleAnd = dtoken.CheckRoleAnd CheckRoleOr = dtoken.CheckRoleOr CheckDisable = dtoken.CheckDisable RenewTimeout = dtoken.RenewTimeout ForEachTerminal = dtoken.ForEachTerminal ForEachTerminalByDevice = dtoken.ForEachTerminalByDevice GetSession = dtoken.GetSession GetSessionByToken = dtoken.GetSessionByToken GetTokenValueListByLoginID = dtoken.GetTokenValueListByLoginID GetTokenValueListByDeviceAndDeviceId = dtoken.GetTokenValueListByDeviceAndDeviceId GetTokenValueListByDevice = dtoken.GetTokenValueListByDevice GetTerminalListByLoginID = dtoken.GetTerminalListByLoginID GetTerminalListByLoginIDAndDevice = dtoken.GetTerminalListByLoginIDAndDevice GetTerminalInfoByToken = dtoken.GetTerminalInfoByToken GetTokenValueByLoginID = dtoken.GetTokenValueByLoginID GetTokenValueByLoginIDAndDevice = dtoken.GetTokenValueByLoginIDAndDevice SearchTokenValue = dtoken.SearchTokenValue SearchSessionId = dtoken.SearchSessionId AddPermissions = dtoken.AddPermissions AddPermissionsByToken = dtoken.AddPermissionsByToken RemovePermissions = dtoken.RemovePermissions RemovePermissionsByToken = dtoken.RemovePermissionsByToken GetPermissions = dtoken.GetPermissions GetPermissionsByToken = dtoken.GetPermissionsByToken HasPermission = dtoken.HasPermission HasPermissionByToken = dtoken.HasPermissionByToken HasPermissionsAnd = dtoken.HasPermissionsAnd HasPermissionsAndByToken = dtoken.HasPermissionsAndByToken HasPermissionsOr = dtoken.HasPermissionsOr HasPermissionsOrByToken = dtoken.HasPermissionsOrByToken AddRoles = dtoken.AddRoles AddRolesByToken = dtoken.AddRolesByToken RemoveRoles = dtoken.RemoveRoles RemoveRolesByToken = dtoken.RemoveRolesByToken GetRoles = dtoken.GetRoles GetRolesByToken = dtoken.GetRolesByToken HasRole = dtoken.HasRole HasRoleByToken = dtoken.HasRoleByToken HasRolesAnd = dtoken.HasRolesAnd HasRolesAndByToken = dtoken.HasRolesAndByToken HasRolesOr = dtoken.HasRolesOr HasRolesOrByToken = dtoken.HasRolesOrByToken GenerateNonce = dtoken.GenerateNonce GenerateNonceWithTimeout = dtoken.GenerateNonceWithTimeout VerifyNonce = dtoken.VerifyNonce VerifyAndConsumeNonce = dtoken.VerifyAndConsumeNonce IsNonceValid = dtoken.IsNonceValid GetNonceTTL = dtoken.GetNonceTTL RegisterOAuth2Client = dtoken.RegisterOAuth2Client UnregisterOAuth2Client = dtoken.UnregisterOAuth2Client GetOAuth2Client = dtoken.GetOAuth2Client OAuth2Token = dtoken.OAuth2Token GenerateOAuth2AuthorizationCode = dtoken.GenerateOAuth2AuthorizationCode GenerateOAuth2AuthorizationCodeWithPKCE = dtoken.GenerateOAuth2AuthorizationCodeWithPKCE ExchangeOAuth2CodeForToken = dtoken.ExchangeOAuth2CodeForToken ExchangeOAuth2CodeForTokenWithPKCE = dtoken.ExchangeOAuth2CodeForTokenWithPKCE OAuth2ClientCredentialsToken = dtoken.OAuth2ClientCredentialsToken OAuth2PasswordGrantToken = dtoken.OAuth2PasswordGrantToken RefreshOAuth2AccessToken = dtoken.RefreshOAuth2AccessToken ValidateOAuth2AccessToken = dtoken.ValidateOAuth2AccessToken ValidateOAuth2AccessTokenAndGetInfo = dtoken.ValidateOAuth2AccessTokenAndGetInfo RevokeOAuth2Token = dtoken.RevokeOAuth2Token )
DToken operations forward all exported dtoken APIs DToken 鎿嶄綔杞彂 dtoken 鐨勫叏閮ㄥ叕寮€ API銆?
var ( CheckPermissionByToken = dtoken.CheckPermissionByToken CheckPermissionAndByToken = dtoken.CheckPermissionAndByToken CheckPermissionOrByToken = dtoken.CheckPermissionOrByToken CheckRoleByToken = dtoken.CheckRoleByToken CheckRoleAndByToken = dtoken.CheckRoleAndByToken CheckRoleOrByToken = dtoken.CheckRoleOrByToken SetSessionValue = dtoken.SetSessionValue GetSessionValue = dtoken.GetSessionValue DeleteSessionValue = dtoken.DeleteSessionValue CreateTicket = dtoken.CreateTicket CreateTicketWithOptions = dtoken.CreateTicketWithOptions ValidateTicket = dtoken.ValidateTicket ValidateTicketWithOptions = dtoken.ValidateTicketWithOptions ConsumeTicket = dtoken.ConsumeTicket ConsumeTicketWithOptions = dtoken.ConsumeTicketWithOptions RevokeTicket = dtoken.RevokeTicket GetTicketStatus = dtoken.GetTicketStatus GetTicketTTL = dtoken.GetTicketTTL CreateShortKey = dtoken.CreateShortKey CreateShortKeyWithOptions = dtoken.CreateShortKeyWithOptions ConfirmShortKey = dtoken.ConfirmShortKey ConfirmShortKeyWithOptions = dtoken.ConfirmShortKeyWithOptions ValidateShortKey = dtoken.ValidateShortKey ValidateShortKeyWithOptions = dtoken.ValidateShortKeyWithOptions ConsumeShortKey = dtoken.ConsumeShortKey ConsumeShortKeyWithOptions = dtoken.ConsumeShortKeyWithOptions RevokeShortKey = dtoken.RevokeShortKey GetShortKeyStatus = dtoken.GetShortKeyStatus GetShortKeyTTL = dtoken.GetShortKeyTTL )
Additional facade operations keep framework imports self-contained. Additional facade 操作保持框架包自包含。
Functions ¶
func AccessMiddleware ¶ added in v0.0.3
func AccessMiddleware(opts ...AuthOption) func(http.Handler) http.Handler
AccessMiddleware resolves route rules and checks login, permissions, and roles AccessMiddleware 解析路由规则并校验登录、权限、角色
func AddPermissionsByCtx ¶
AddPermissionsByCtx adds permissions to current token AddPermissionsByCtx 为当前 token 添加权限。
func AddRolesByCtx ¶
AddRolesByCtx adds roles to current token AddRolesByCtx 为当前 token 添加角色。
func AuthGroup ¶
func AuthGroup(group chiRouter.Router, opts ...AuthOption) chiRouter.Router
AuthGroup creates auth route group AuthGroup 创建认证路由组
func AuthMiddleware ¶
func AuthMiddleware(opts ...AuthOption) func(http.Handler) http.Handler
AuthMiddleware checks login status AuthMiddleware 校验登录状态
func CheckAllHandler ¶
func CheckAllHandler(roles []string, perms []string) http.HandlerFunc
CheckAllHandler creates combined auth handler CheckAllHandler 创建组合认证检查处理器
func CheckDisableByCtx ¶ added in v0.0.3
CheckDisableByCtx checks current account disable state CheckDisableByCtx ?
func CheckDisableDeviceAndDeviceIDByCtx ¶ added in v0.0.3
CheckDisableDeviceAndDeviceIDByCtx checks current account device ID disable state CheckDisableDeviceAndDeviceIDByCtx ID ?
func CheckDisableDeviceByCtx ¶ added in v0.0.3
CheckDisableDeviceByCtx checks current account device disable state CheckDisableDeviceByCtx ?
func CheckDisableHandler ¶
func CheckDisableHandler(authType ...string) http.HandlerFunc
CheckDisableHandler creates disable check handler CheckDisableHandler 创建封禁检查处理器
func CheckDisableServiceByCtx ¶ added in v0.0.3
CheckDisableServiceByCtx checks current account service disable state CheckDisableServiceByCtx ?
func CheckDisableServiceLevelByCtx ¶ added in v0.0.3
CheckDisableServiceLevelByCtx checks current account service level disable state CheckDisableServiceLevelByCtx ?
func CheckLoginAndPermissionHandler ¶
func CheckLoginAndPermissionHandler(perms ...string) http.HandlerFunc
CheckLoginAndPermissionHandler creates login and permission handler CheckLoginAndPermissionHandler 创建登录与权限检查处理器
func CheckLoginAndRoleHandler ¶
func CheckLoginAndRoleHandler(roles ...string) http.HandlerFunc
CheckLoginAndRoleHandler creates login and role handler CheckLoginAndRoleHandler 创建登录与角色检查处理器
func CheckLoginByCtx ¶
CheckLoginByCtx checks current request login state CheckLoginByCtx 校验当前请求登录状态。
func CheckLoginHandler ¶
func CheckLoginHandler(authType ...string) http.HandlerFunc
CheckLoginHandler creates login check handler CheckLoginHandler 创建登录检查处理器
func CheckPermissionByCtx ¶ added in v0.0.3
CheckPermissionByCtx checks current user permission CheckPermissionByCtx
func CheckPermissionHandler ¶
func CheckPermissionHandler(perms ...string) http.HandlerFunc
CheckPermissionHandler creates permission check handler CheckPermissionHandler 创建权限检查处理器
func CheckPermissionHandlerWithAuthType ¶
func CheckPermissionHandlerWithAuthType(authType string, perms ...string) http.HandlerFunc
CheckPermissionHandlerWithAuthType creates permission check handler CheckPermissionHandlerWithAuthType 创建带认证类型的权限检查处理器
func CheckPermissionsAndByCtx ¶ added in v0.0.3
CheckPermissionsAndByCtx delegates to DToken context CheckPermissionsAndByCtx 转发到 DToken 上下文。
func CheckPermissionsOrByCtx ¶ added in v0.0.3
CheckPermissionsOrByCtx delegates to DToken context CheckPermissionsOrByCtx 转发到 DToken 上下文。
func CheckRoleByCtx ¶ added in v0.0.3
CheckRoleByCtx checks current user role CheckRoleByCtx
func CheckRoleHandler ¶
func CheckRoleHandler(roles ...string) http.HandlerFunc
CheckRoleHandler creates role check handler CheckRoleHandler 创建角色检查处理器
func CheckRoleHandlerWithAuthType ¶
func CheckRoleHandlerWithAuthType(authType string, roles ...string) http.HandlerFunc
CheckRoleHandlerWithAuthType creates role check handler CheckRoleHandlerWithAuthType 创建带认证类型的角色检查处理器
func CheckRolesAndByCtx ¶ added in v0.0.3
CheckRolesAndByCtx delegates to DToken context CheckRolesAndByCtx 转发到 DToken 上下文。
func CheckRolesOrByCtx ¶ added in v0.0.3
CheckRolesOrByCtx delegates to DToken context CheckRolesOrByCtx 转发到 DToken 上下文。
func ClearTokenCookieByCtx ¶ added in v0.0.3
ClearTokenCookieByCtx clears token cookie ClearTokenCookieByCtx ?Token Cookie
func ConfirmShortKeyByCtx ¶ added in v0.0.3
func ConfirmShortKeyByCtx(ctx context.Context, key string, opts shortkey.ConfirmOptions) (*shortkey.ShortKey, error)
ConfirmShortKeyByCtx confirms short key ConfirmShortKeyByCtx ?Key
func ConfirmShortKeyForCurrentLoginByCtx ¶ added in v0.0.3
func ConfirmShortKeyForCurrentLoginByCtx(ctx context.Context, key string, opts shortkey.ConfirmOptions) (*shortkey.ShortKey, error)
ConfirmShortKeyForCurrentLoginByCtx confirms short key for current user ConfirmShortKeyForCurrentLoginByCtx ?Key
func ConsumeShortKeyByCtx ¶ added in v0.0.3
func ConsumeShortKeyByCtx(ctx context.Context, key string, opts ...shortkey.ValidateOptions) (*shortkey.ConsumeResult, error)
ConsumeShortKeyByCtx consumes short key ConsumeShortKeyByCtx ?Key
func ConsumeTicketByCtx ¶ added in v0.0.3
func ConsumeTicketByCtx(ctx context.Context, ticketValue string, opts ...ticket.ValidateOptions) (*ticket.ConsumeResult, error)
ConsumeTicketByCtx consumes ticket ConsumeTicketByCtx ?Ticket
func CreateShortKeyByCtx ¶ added in v0.0.3
func CreateShortKeyByCtx(ctx context.Context, opts shortkey.CreateOptions) (*shortkey.ShortKey, error)
CreateShortKeyByCtx creates short key CreateShortKeyByCtx ?Key
func CreateShortKeyWithTimeoutByCtx ¶ added in v0.0.3
func CreateShortKeyWithTimeoutByCtx(ctx context.Context, opts shortkey.CreateOptions, timeout time.Duration) (*shortkey.ShortKey, error)
CreateShortKeyWithTimeoutByCtx creates short key with timeout CreateShortKeyWithTimeoutByCtx ?Key
func CreateTicketByCtx ¶ added in v0.0.3
CreateTicketByCtx creates ticket CreateTicketByCtx ?Ticket
func CreateTicketForCurrentLoginByCtx ¶ added in v0.0.3
func CreateTicketForCurrentLoginByCtx(ctx context.Context, opts ticket.CreateOptions) (*ticket.Ticket, error)
CreateTicketForCurrentLoginByCtx creates ticket for current user CreateTicketForCurrentLoginByCtx ?Ticket
func CreateTicketWithTimeoutByCtx ¶ added in v0.0.3
func CreateTicketWithTimeoutByCtx(ctx context.Context, opts ticket.CreateOptions, timeout time.Duration) (*ticket.Ticket, error)
CreateTicketWithTimeoutByCtx creates ticket with timeout CreateTicketWithTimeoutByCtx ?Ticket
func DeleteSessionValueByCtx ¶ added in v0.0.3
DeleteSessionValueByCtx deletes current session value DeleteSessionValueByCtx ?
func DisableByCtx ¶
DisableByCtx disables current user DisableByCtx 封禁当前用户。
func DisableDeviceAndDeviceIDByCtx ¶ added in v0.0.3
func DisableDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string, duration time.Duration, reason ...string) error
DisableDeviceAndDeviceIDByCtx delegates to DToken context DisableDeviceAndDeviceIDByCtx 转发到 DToken 上下文。
func DisableDeviceByCtx ¶ added in v0.0.3
func DisableDeviceByCtx(ctx context.Context, device string, duration time.Duration, reason ...string) error
DisableDeviceByCtx disables current account device DisableDeviceByCtx
func DisableServiceByCtx ¶ added in v0.0.3
func DisableServiceByCtx(ctx context.Context, service string, duration time.Duration, reason ...string) error
DisableServiceByCtx disables current account service DisableServiceByCtx
func DisableServiceLevelByCtx ¶ added in v0.0.3
func DisableServiceLevelByCtx(ctx context.Context, service string, level int, duration time.Duration, reason ...string) error
DisableServiceLevelByCtx disables current account service level DisableServiceLevelByCtx ?
func ExchangeOAuth2CodeForTokenByCtx ¶ added in v0.0.3
func ExchangeOAuth2CodeForTokenByCtx(ctx context.Context, code, clientID, clientSecret, redirectURI string) (*oauth2.AccessToken, error)
ExchangeOAuth2CodeForTokenByCtx exchanges OAuth2 code for token ExchangeOAuth2CodeForTokenByCtx OAuth2 ?Token
func ExchangeOAuth2CodeForTokenWithPKCEByCtx ¶ added in v0.0.3
func ExchangeOAuth2CodeForTokenWithPKCEByCtx(ctx context.Context, code, clientID, clientSecret, redirectURI, codeVerifier string) (*oauth2.AccessToken, error)
ExchangeOAuth2CodeForTokenWithPKCEByCtx exchanges OAuth2 code for token with PKCE ExchangeOAuth2CodeForTokenWithPKCEByCtx PKCE ?Token
func ForEachTerminalByCtx ¶ added in v0.0.3
func ForEachTerminalByCtx(ctx context.Context, visitor manager.TerminalVisitor) error
ForEachTerminalByCtx visits current user terminals ForEachTerminalByCtx
func ForEachTerminalByDeviceByCtx ¶ added in v0.0.3
func ForEachTerminalByDeviceByCtx(ctx context.Context, device string, visitor manager.TerminalVisitor) error
ForEachTerminalByDeviceByCtx visits current user terminals by device ForEachTerminalByDeviceByCtx ?
func GenerateNonceByCtx ¶
GenerateNonceByCtx generates nonce with current manager GenerateNonceByCtx 使用当前管理器生成 nonce。
func GenerateNonceWithTimeoutByCtx ¶ added in v0.0.3
GenerateNonceWithTimeoutByCtx generates nonce with timeout GenerateNonceWithTimeoutByCtx ?Nonce
func GenerateOAuth2AuthorizationCodeByCtx ¶ added in v0.0.3
func GenerateOAuth2AuthorizationCodeByCtx(ctx context.Context, clientID, userID, redirectURI string, scopes []string) (*oauth2.AuthorizationCode, error)
GenerateOAuth2AuthorizationCodeByCtx delegates to DToken context GenerateOAuth2AuthorizationCodeByCtx 转发到 DToken 上下文。
func GenerateOAuth2AuthorizationCodeWithPKCEByCtx ¶ added in v0.0.3
func GenerateOAuth2AuthorizationCodeWithPKCEByCtx(ctx context.Context, clientID, userID, redirectURI string, scopes []string, codeChallenge, codeChallengeMethod string) (*oauth2.AuthorizationCode, error)
GenerateOAuth2AuthorizationCodeWithPKCEByCtx delegates to DToken context GenerateOAuth2AuthorizationCodeWithPKCEByCtx 转发到 DToken 上下文。
func GetDTokenContext ¶
func GetDTokenContext(r *http.Request) (*DContext.DTokenContext, bool)
GetDTokenContext gets cached DToken context GetDTokenContext 获取缓存的 DToken 上下文
func GetDTokenContextByCtx ¶
func GetDTokenContextByCtx(ctx context.Context) (*DContext.DTokenContext, bool)
GetDTokenContextByCtx gets DToken context by context GetDTokenContextByCtx 从上下文获取 DToken 上下文
func GetDeviceByCtx ¶
GetDeviceByCtx gets current token device GetDeviceByCtx 获取当前 token 设备类型。
func GetDeviceIDByCtx ¶
GetDeviceIDByCtx gets current token device id GetDeviceIDByCtx 获取当前 token 设备 ID。
func GetDisableDeviceAndDeviceIDInfoByCtx ¶ added in v0.0.3
func GetDisableDeviceAndDeviceIDInfoByCtx(ctx context.Context, device, deviceId string) (*manager.DeviceDisableInfo, error)
GetDisableDeviceAndDeviceIDInfoByCtx gets current account device ID disable info GetDisableDeviceAndDeviceIDInfoByCtx ID
func GetDisableDeviceAndDeviceIDTTLByCtx ¶ added in v0.0.3
func GetDisableDeviceAndDeviceIDTTLByCtx(ctx context.Context, device, deviceId string) (int64, error)
GetDisableDeviceAndDeviceIDTTLByCtx gets current account device ID disable TTL GetDisableDeviceAndDeviceIDTTLByCtx ID
func GetDisableDeviceInfoByCtx ¶ added in v0.0.3
func GetDisableDeviceInfoByCtx(ctx context.Context, device string) (*manager.DeviceDisableInfo, error)
GetDisableDeviceInfoByCtx gets current account device disable info GetDisableDeviceInfoByCtx
func GetDisableDeviceTTLByCtx ¶ added in v0.0.3
GetDisableDeviceTTLByCtx gets current account device disable TTL GetDisableDeviceTTLByCtx
func GetDisableInfoByCtx ¶
func GetDisableInfoByCtx(ctx context.Context) (*manager.DisableInfo, error)
GetDisableInfoByCtx gets current user disable info GetDisableInfoByCtx 获取当前用户封禁信息。
func GetDisableServiceInfoByCtx ¶ added in v0.0.3
func GetDisableServiceInfoByCtx(ctx context.Context, service string) (*manager.ServiceDisableInfo, error)
GetDisableServiceInfoByCtx gets current account service disable info GetDisableServiceInfoByCtx
func GetDisableServiceTTLByCtx ¶ added in v0.0.3
GetDisableServiceTTLByCtx gets current account service disable TTL GetDisableServiceTTLByCtx
func GetDisableTTLByCtx ¶
GetDisableTTLByCtx gets current user disable ttl GetDisableTTLByCtx 获取当前用户封禁剩余时间。
func GetHandler ¶
func GetHandler(handler http.HandlerFunc, annotations ...*Annotation) http.HandlerFunc
GetHandler gets annotation handler GetHandler 获取注解处理器
func GetLatestTokenValueByCtx ¶ added in v0.0.3
GetLatestTokenValueByCtx gets latest current user token GetLatestTokenValueByCtx ?Token
func GetLoginIDByCtx ¶
GetLoginIDByCtx gets login ID by context GetLoginIDByCtx 从上下文获取登录 ID
func GetLoginIDFromRequest ¶
func GetLoginIDFromRequest(w http.ResponseWriter, r *http.Request, authType ...string) (string, error)
GetLoginIDFromRequest gets login ID from request GetLoginIDFromRequest 从请求获取登录 ID
func GetManagerByCtx ¶ added in v0.0.3
GetManagerByCtx gets current DToken manager GetManagerByCtx 获取当前 DToken 管理器。
func GetNonceTTLByCtx ¶ added in v0.0.3
GetNonceTTLByCtx gets nonce TTL GetNonceTTLByCtx ?Nonce ?
func GetOAuth2ClientByCtx ¶ added in v0.0.3
GetOAuth2ClientByCtx delegates to DToken context GetOAuth2ClientByCtx 转发到 DToken 上下文。
func GetOnlineTerminalCountByCtx ¶
GetOnlineTerminalCountByCtx gets current user online terminal count GetOnlineTerminalCountByCtx 获取当前用户在线终端数量。
func GetOnlineTerminalCountByDeviceAndDeviceIDByCtx ¶ added in v0.0.3
func GetOnlineTerminalCountByDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string) (int, error)
GetOnlineTerminalCountByDeviceAndDeviceIDByCtx gets online count by device ID GetOnlineTerminalCountByDeviceAndDeviceIDByCtx ?ID ?
func GetOnlineTerminalCountByDeviceByCtx ¶ added in v0.0.3
GetOnlineTerminalCountByDeviceByCtx delegates to DToken context GetOnlineTerminalCountByDeviceByCtx 转发到 DToken 上下文。
func GetPermissionsByCtx ¶
GetPermissionsByCtx gets current user permissions GetPermissionsByCtx 获取当前用户权限列表。
func GetPermissionsByTokenByCtx ¶
GetPermissionsByTokenByCtx gets current token permissions GetPermissionsByTokenByCtx 使用当前 token 获取权限列表。
func GetRefreshTokenTTLByCtx ¶ added in v0.0.3
GetRefreshTokenTTLByCtx gets refresh token TTL GetRefreshTokenTTLByCtx Token ?
func GetRequestContextByCtx ¶ added in v0.0.3
func GetRequestContextByCtx(ctx context.Context) (adapter.RequestContext, error)
GetRequestContextByCtx gets raw request context GetRequestContextByCtx 获取原始请求上下文。
func GetRolesByCtx ¶
GetRolesByCtx gets current user roles GetRolesByCtx 获取当前用户角色列表。
func GetRolesByTokenByCtx ¶
GetRolesByTokenByCtx gets current token roles GetRolesByTokenByCtx 使用当前 token 获取角色列表。
func GetSessionByCtx ¶
GetSessionByCtx gets current user session GetSessionByCtx 获取当前用户会话。
func GetSessionByTokenByCtx ¶
GetSessionByTokenByCtx gets current token session GetSessionByTokenByCtx 获取当前 token 会话。
func GetSessionValueByCtx ¶ added in v0.0.3
GetSessionValueByCtx gets current session value GetSessionValueByCtx ?
func GetShortKeyStatusByCtx ¶ added in v0.0.3
GetShortKeyStatusByCtx gets short key status GetShortKeyStatusByCtx ?Key ?
func GetShortKeyTTLByCtx ¶ added in v0.0.3
GetShortKeyTTLByCtx gets short key TTL GetShortKeyTTLByCtx ?Key ?
func GetTerminalInfoByCtx ¶ added in v0.0.3
func GetTerminalInfoByCtx(ctx context.Context) (*manager.TerminalInfo, error)
GetTerminalInfoByCtx gets current terminal info GetTerminalInfoByCtx
func GetTerminalListByCtx ¶ added in v0.0.3
GetTerminalListByCtx delegates to DToken context GetTerminalListByCtx 转发到 DToken 上下文。
func GetTicketStatusByCtx ¶ added in v0.0.3
GetTicketStatusByCtx gets ticket status GetTicketStatusByCtx ?Ticket ?
func GetTicketTTLByCtx ¶ added in v0.0.3
GetTicketTTLByCtx gets ticket TTL GetTicketTTLByCtx ?Ticket ?
func GetTokenCreateTimeByCtx ¶
GetTokenCreateTimeByCtx gets current token create time GetTokenCreateTimeByCtx 获取当前 token 创建时间。
func GetTokenFromRequest ¶
GetTokenFromRequest gets token from request GetTokenFromRequest 从请求获取 Token
func GetTokenInfoByCtx ¶
GetTokenInfoByCtx gets token info by context GetTokenInfoByCtx 从上下文获取 Token 信息
func GetTokenTTLByCtx ¶
GetTokenTTLByCtx gets current token TTL GetTokenTTLByCtx 获取当前 token 剩余有效期。
func GetTokenValueByCtx ¶
GetTokenValueByCtx gets token value from current Chi context GetTokenValueByCtx 从当前 Chi 上下文获取 token 值。
func GetTokenValueListByCtx ¶
GetTokenValueListByCtx gets current user token list GetTokenValueListByCtx 获取当前用户 token 列表。
func GetTokenValueListByDeviceAndDeviceIDByCtx ¶ added in v0.0.3
func GetTokenValueListByDeviceAndDeviceIDByCtx(ctx context.Context, device, deviceId string, checkAlive ...bool) ([]string, error)
GetTokenValueListByDeviceAndDeviceIDByCtx delegates to DToken context GetTokenValueListByDeviceAndDeviceIDByCtx 转发到 DToken 上下文。
func GetTokenValueListByDeviceByCtx ¶ added in v0.0.3
func GetTokenValueListByDeviceByCtx(ctx context.Context, device string, checkAlive ...bool) ([]string, error)
GetTokenValueListByDeviceByCtx delegates to DToken context GetTokenValueListByDeviceByCtx 转发到 DToken 上下文。
func HasPermissionByCtx ¶
HasPermissionByCtx checks current user permission HasPermissionByCtx 检查当前用户权限。
func HasPermissionsAndByCtx ¶
HasPermissionsAndByCtx checks whether current user has all permissions HasPermissionsAndByCtx 检查当前用户是否拥有全部权限。
func HasPermissionsByCtx ¶
HasPermissionsByCtx checks whether current user has any permission HasPermissionsByCtx 检查当前用户是否拥有任一权限。
func HasPermissionsOrByCtx ¶
HasPermissionsOrByCtx checks whether current user has any permission HasPermissionsOrByCtx 检查当前用户是否拥有任一权限。
func HasRoleByCtx ¶
HasRoleByCtx checks current user role HasRoleByCtx 检查当前用户角色。
func HasRolesAndByCtx ¶
HasRolesAndByCtx checks whether current user has all roles HasRolesAndByCtx 检查当前用户是否拥有全部角色。
func HasRolesByCtx ¶
HasRolesByCtx checks whether current user has any role HasRolesByCtx 检查当前用户是否拥有任一角色。
func HasRolesOrByCtx ¶
HasRolesOrByCtx checks whether current user has any role HasRolesOrByCtx 检查当前用户是否拥有任一角色。
func IgnoreHandler ¶
func IgnoreHandler() http.HandlerFunc
IgnoreHandler creates ignore auth handler IgnoreHandler 创建忽略认证处理器
func IntrospectTokenByCtx ¶ added in v0.0.3
func IntrospectTokenByCtx(ctx context.Context) (*manager.TokenIntrospection, error)
IntrospectTokenByCtx inspects current token without renewal side effects IntrospectTokenByCtx 无续期副作用地检查当前 token 状态
func IsDisableByCtx ¶
IsDisableByCtx checks whether current user is disabled IsDisableByCtx 检查当前用户是否被封禁。
func IsDisableDeviceAndDeviceIDByCtx ¶ added in v0.0.3
IsDisableDeviceAndDeviceIDByCtx checks current account device ID disable state IsDisableDeviceAndDeviceIDByCtx ?ID ?
func IsDisableDeviceByCtx ¶ added in v0.0.3
IsDisableDeviceByCtx checks current account device disable state IsDisableDeviceByCtx ?
func IsDisableServiceByCtx ¶ added in v0.0.3
IsDisableServiceByCtx checks current account service disable state IsDisableServiceByCtx ?
func IsDisableServiceLevelByCtx ¶ added in v0.0.3
IsDisableServiceLevelByCtx checks current account service level disable state IsDisableServiceLevelByCtx ?
func IsLoginByCtx ¶
IsLoginByCtx checks current request login state IsLoginByCtx 检查当前请求登录状态。
func IsLoginFromRequest ¶
IsLoginFromRequest checks login state from request IsLoginFromRequest 从请求检查登录状态
func IsValidNonceByCtx ¶ added in v0.0.3
IsValidNonceByCtx checks nonce state IsValidNonceByCtx ?Nonce ?
func KickoutByCtx ¶
KickoutByCtx kicks out current request token KickoutByCtx 踢出当前请求 token。
func KickoutByDeviceAndDeviceIDByCtx ¶ added in v0.0.3
KickoutByDeviceAndDeviceIDByCtx delegates to DToken context KickoutByDeviceAndDeviceIDByCtx 转发到 DToken 上下文。
func KickoutByDeviceByCtx ¶ added in v0.0.3
KickoutByDeviceByCtx kicks out current user by device KickoutByDeviceByCtx ?
func KickoutByLoginIDByCtx ¶ added in v0.0.3
KickoutByLoginIDByCtx delegates to DToken context KickoutByLoginIDByCtx 转发到 DToken 上下文。
func LoginByCtx ¶ added in v0.0.3
LoginByCtx logs in current Chi request LoginByCtx Chi
func LoginByTokenByCtx ¶
LoginByTokenByCtx renews current token login state LoginByTokenByCtx 使用当前 token 续期登录态。
func LoginWithCookieByCtx ¶ added in v0.0.3
func LoginWithCookieByCtx(ctx context.Context, loginID string, deviceAndDeviceId ...string) (string, error)
LoginWithCookieByCtx logs in and writes token cookie LoginWithCookieByCtx ?Token Cookie
func LoginWithCookieOptionsByCtx ¶ added in v0.0.3
LoginWithCookieOptionsByCtx logs in with options and writes token cookie LoginWithCookieOptionsByCtx ?Token Cookie
func LoginWithCookieTimeoutByCtx ¶ added in v0.0.3
func LoginWithCookieTimeoutByCtx(ctx context.Context, loginID string, timeout time.Duration, deviceAndDeviceId ...string) (string, error)
LoginWithCookieTimeoutByCtx logs in with timeout and writes token cookie LoginWithCookieTimeoutByCtx Token Cookie
func LoginWithOptionsByCtx ¶ added in v0.0.3
LoginWithOptionsByCtx logs in current Chi request with options LoginWithOptionsByCtx Chi
func LoginWithRefreshTokenByCtx ¶ added in v0.0.3
func LoginWithRefreshTokenByCtx(ctx context.Context, loginID string, deviceAndDeviceId ...string) (*manager.RefreshTokenPair, error)
LoginWithRefreshTokenByCtx logs in and issues refresh token LoginWithRefreshTokenByCtx ?Token
func LoginWithRefreshTokenOptionsByCtx ¶ added in v0.0.3
func LoginWithRefreshTokenOptionsByCtx(ctx context.Context, opts manager.RefreshTokenOptions) (*manager.RefreshTokenPair, error)
LoginWithRefreshTokenOptionsByCtx logs in with refresh token options LoginWithRefreshTokenOptionsByCtx Token
func LoginWithTimeoutByCtx ¶ added in v0.0.3
func LoginWithTimeoutByCtx(ctx context.Context, loginID string, timeout time.Duration, deviceAndDeviceId ...string) (string, error)
LoginWithTimeoutByCtx logs in current Chi request with timeout LoginWithTimeoutByCtx Chi
func LogoutByCtx ¶
LogoutByCtx logs out current request token LogoutByCtx 登出当前请求 token。
func LogoutByDeviceAndDeviceIdByCtx ¶
LogoutByDeviceAndDeviceIdByCtx logs out current user by device and id LogoutByDeviceAndDeviceIdByCtx 按设备和设备 ID 登出当前用户。
func LogoutByDeviceByCtx ¶
LogoutByDeviceByCtx logs out current user by device LogoutByDeviceByCtx 按设备登出当前用户。
func LogoutByLoginIDByCtx ¶
LogoutByLoginIDByCtx logs out all terminals of current user LogoutByLoginIDByCtx 登出当前用户所有终端。
func LogoutWithCookieByCtx ¶ added in v0.0.3
LogoutWithCookieByCtx logs out and clears token cookie LogoutWithCookieByCtx ?Token Cookie
func NewBuilder ¶
NewBuilder creates a default DToken builder NewBuilder 鍒涘缓榛樿 DToken 鏋勫缓鍣ㄣ€?
func NewChiContext ¶
func NewChiContext(w http.ResponseWriter, r *http.Request) adapter.RequestContext
NewChiContext creates request context adapter NewChiContext 创建请求上下文适配器
func OAuth2ClientCredentialsTokenByCtx ¶ added in v0.0.3
func OAuth2ClientCredentialsTokenByCtx(ctx context.Context, clientID, clientSecret string, scopes []string) (*oauth2.AccessToken, error)
OAuth2ClientCredentialsTokenByCtx gets OAuth2 token by client credentials OAuth2ClientCredentialsTokenByCtx ?OAuth2 Token
func OAuth2PasswordGrantTokenByCtx ¶ added in v0.0.3
func OAuth2PasswordGrantTokenByCtx(ctx context.Context, clientID, clientSecret, username, password string, scopes []string, validateUser oauth2.UserValidator) (*oauth2.AccessToken, error)
OAuth2PasswordGrantTokenByCtx gets OAuth2 token by password grant OAuth2PasswordGrantTokenByCtx OAuth2 Token
func OAuth2TokenByCtx ¶ added in v0.0.3
func OAuth2TokenByCtx(ctx context.Context, req *oauth2.TokenRequest, validateUser oauth2.UserValidator) (*oauth2.AccessToken, error)
OAuth2TokenByCtx handles OAuth2 token request OAuth2TokenByCtx OAuth2 Token
func PermissionGroup ¶
PermissionGroup creates permission route group PermissionGroup 创建权限路由组
func PermissionMiddleware ¶
PermissionMiddleware checks permissions PermissionMiddleware 校验权限
func PermissionPathMiddleware ¶
func PermissionPathMiddleware(permissions []string, opts ...AuthOption) func(http.Handler) http.Handler
PermissionPathMiddleware checks path permissions PermissionPathMiddleware 基于路径校验权限
func RefreshOAuth2AccessTokenByCtx ¶ added in v0.0.3
func RefreshOAuth2AccessTokenByCtx(ctx context.Context, clientID, refreshToken, clientSecret string) (*oauth2.AccessToken, error)
RefreshOAuth2AccessTokenByCtx refreshes OAuth2 access token RefreshOAuth2AccessTokenByCtx OAuth2 Token
func RefreshTokenByCtx ¶ added in v0.0.3
RefreshTokenByCtx refreshes access token RefreshTokenByCtx Token
func RegisterDTokenContextMiddleware ¶
func RegisterDTokenContextMiddleware(opts ...AuthOption) func(http.Handler) http.Handler
RegisterDTokenContextMiddleware registers DToken context middleware RegisterDTokenContextMiddleware 注册 DToken 上下文中间件
func RegisterOAuth2ClientByCtx ¶ added in v0.0.3
RegisterOAuth2ClientByCtx delegates to DToken context RegisterOAuth2ClientByCtx 转发到 DToken 上下文。
func RemovePermissionsByCtx ¶
RemovePermissionsByCtx removes permissions from current token RemovePermissionsByCtx 从当前 token 移除权限。
func RemoveRolesByCtx ¶
RemoveRolesByCtx removes roles from current token RemoveRolesByCtx 从当前 token 移除角色。
func RenewTimeoutByCtx ¶
RenewTimeoutByCtx renews current token timeout RenewTimeoutByCtx 续期当前 token 过期时间。
func ReplaceByCtx ¶
ReplaceByCtx replaces current request token ReplaceByCtx 顶替当前请求 token。
func ReplaceByDeviceAndDeviceIDByCtx ¶ added in v0.0.3
ReplaceByDeviceAndDeviceIDByCtx delegates to DToken context ReplaceByDeviceAndDeviceIDByCtx 转发到 DToken 上下文。
func ReplaceByDeviceByCtx ¶ added in v0.0.3
ReplaceByDeviceByCtx replaces current user by device ReplaceByDeviceByCtx ?
func ReplaceByLoginIDByCtx ¶ added in v0.0.3
ReplaceByLoginIDByCtx delegates to DToken context ReplaceByLoginIDByCtx 转发到 DToken 上下文。
func RevokeOAuth2TokenByCtx ¶ added in v0.0.3
RevokeOAuth2TokenByCtx revokes OAuth2 token RevokeOAuth2TokenByCtx OAuth2 Token
func RevokeRefreshTokenByCtx ¶ added in v0.0.3
RevokeRefreshTokenByCtx revokes refresh token RevokeRefreshTokenByCtx Token
func RevokeShortKeyByCtx ¶ added in v0.0.3
RevokeShortKeyByCtx revokes short key RevokeShortKeyByCtx ?Key
func RevokeTicketByCtx ¶ added in v0.0.3
RevokeTicketByCtx revokes ticket RevokeTicketByCtx ?Ticket
func RoleAndPermissionGroup ¶
func RoleAndPermissionGroup(group chiRouter.Router, roles []string, perms []string, opts ...AuthOption) chiRouter.Router
RoleAndPermissionGroup creates role and permission route group RoleAndPermissionGroup 创建角色与权限路由组
func RoleMiddleware ¶
RoleMiddleware checks roles RoleMiddleware 校验角色
func SearchSessionIDByCtx ¶ added in v0.0.3
SearchSessionIDByCtx searches session ids SearchSessionIDByCtx ?Session ID
func SearchTokenValueByCtx ¶ added in v0.0.3
SearchTokenValueByCtx searches token values SearchTokenValueByCtx ?Token ?
func SetSessionValueByCtx ¶ added in v0.0.3
SetSessionValueByCtx sets current session value SetSessionValueByCtx ?
func SetTokenCookieByCtx ¶ added in v0.0.3
SetTokenCookieByCtx writes token cookie SetTokenCookieByCtx ?Token Cookie
func TerminateByCtx ¶ added in v0.0.3
func TerminateByCtx(ctx context.Context, opts manager.TerminateOptions) error
TerminateByCtx terminates current or specified terminal TerminateByCtx ?
func UnregisterOAuth2ClientByCtx ¶ added in v0.0.3
UnregisterOAuth2ClientByCtx delegates to DToken context UnregisterOAuth2ClientByCtx 转发到 DToken 上下文。
func UntieByCtx ¶
UntieByCtx removes current user disable state UntieByCtx 解封当前用户。
func UntieDeviceAndDeviceIDByCtx ¶ added in v0.0.3
UntieDeviceAndDeviceIDByCtx removes current account device ID disable state UntieDeviceAndDeviceIDByCtx ID
func UntieDeviceByCtx ¶ added in v0.0.3
UntieDeviceByCtx removes current account device disable state UntieDeviceByCtx
func UntieServiceByCtx ¶ added in v0.0.3
UntieServiceByCtx removes current account service disable state UntieServiceByCtx
func ValidateOAuth2AccessTokenAndGetInfoByCtx ¶ added in v0.0.3
func ValidateOAuth2AccessTokenAndGetInfoByCtx(ctx context.Context, accessToken string) (*oauth2.AccessToken, error)
ValidateOAuth2AccessTokenAndGetInfoByCtx delegates to DToken context ValidateOAuth2AccessTokenAndGetInfoByCtx 转发到 DToken 上下文。
func ValidateOAuth2AccessTokenByCtx ¶ added in v0.0.3
ValidateOAuth2AccessTokenByCtx validates OAuth2 access token ValidateOAuth2AccessTokenByCtx OAuth2 Token
func ValidateShortKeyByCtx ¶ added in v0.0.3
func ValidateShortKeyByCtx(ctx context.Context, key string, opts ...shortkey.ValidateOptions) (*shortkey.ShortKey, error)
ValidateShortKeyByCtx validates short key ValidateShortKeyByCtx ?Key
func ValidateTicketByCtx ¶ added in v0.0.3
func ValidateTicketByCtx(ctx context.Context, ticketValue string, opts ...ticket.ValidateOptions) (*ticket.Ticket, error)
ValidateTicketByCtx validates ticket ValidateTicketByCtx ?Ticket
func VerifyAndConsumeNonceByCtx ¶
VerifyAndConsumeNonceByCtx verifies and consumes nonce with current manager VerifyAndConsumeNonceByCtx 使用当前管理器验证并消费 nonce。
func VerifyNonceByCtx ¶
VerifyNonceByCtx verifies nonce with current manager VerifyNonceByCtx 使用当前管理器验证 nonce。
Types ¶
type AccessProvider ¶
type AccessProvider = manager.AccessProvider
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type AccessProviderFunc ¶
type AccessProviderFunc = manager.AccessProviderFunc
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type AccessSubject ¶
type AccessSubject = manager.AccessSubject
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type AccessToken ¶
type AccessToken = oauth2.AccessToken
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type AdminStorage ¶
type AdminStorage = adapter.AdminStorage
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type Annotation ¶
type Annotation struct {
// AuthType specifies auth type AuthType 指定认证类型
AuthType string `json:"authType"`
// CheckLogin indicates login check CheckLogin 表示是否检查登录
CheckLogin bool `json:"checkLogin"`
// CheckRole lists required roles CheckRole 列出需要校验的角色
CheckRole []string `json:"checkRole"`
// CheckPermission lists required permissions CheckPermission 列出需要校验的权限
CheckPermission []string `json:"checkPermission"`
// CheckDisable indicates disable check CheckDisable 表示是否检查封禁
CheckDisable bool `json:"checkDisable"`
// Ignore bypasses authentication Ignore 表示是否忽略认证
Ignore bool `json:"ignore"`
// LogicType sets logic mode LogicType 指定逻辑类型
LogicType LogicType `json:"logicType"`
}
Annotation defines annotation config Annotation 定义注解配置
type AtomicStorage ¶
type AtomicStorage = adapter.AtomicStorage
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type AuthHandleRequest ¶
type AuthHandleRequest struct {
AuthType string
CheckLogin bool
CheckDisable bool
Permissions []string
Roles []string
LogicType LogicType
// contains filtered or unexported fields
}
AuthHandleRequest carries auth check metadata AuthHandleRequest 携带认证校验元数据
func (*AuthHandleRequest) Exit ¶
func (req *AuthHandleRequest) Exit()
Exit stops dtoken checks after custom handling Exit 自定义处理后停止 dtoken 校验
func (*AuthHandleRequest) IsHandled ¶
func (req *AuthHandleRequest) IsHandled() bool
IsHandled reports whether request has been handled IsHandled 判断请求是否已处理
func (*AuthHandleRequest) Next ¶
func (req *AuthHandleRequest) Next()
Next continues request and stops dtoken checks Next 放行请求并停止 dtoken 校验
type AuthOption ¶
type AuthOption func(*AuthOptions)
AuthOption defines auth option setter AuthOption 定义认证选项设置器
func WithAuthType ¶
func WithAuthType(authType string) AuthOption
WithAuthType sets auth type WithAuthType 设置认证类型
func WithBeforeAuthHandler ¶
func WithBeforeAuthHandler(fn BeforeAuthHandler) AuthOption
WithBeforeAuthHandler sets pre auth handler WithBeforeAuthHandler 设置认证前置处理器
func WithFailFunc ¶
func WithFailFunc(fn func(w http.ResponseWriter, r *http.Request, err error)) AuthOption
WithFailFunc sets auth failure callback WithFailFunc 设置认证失败回调
func WithLogicType ¶
func WithLogicType(logicType LogicType) AuthOption
WithLogicType sets logic type WithLogicType 设置逻辑类型
func WithRouteAccessHandler ¶ added in v0.0.3
func WithRouteAccessHandler(fn RouteAccessHandler) AuthOption
WithRouteAccessHandler sets route access handler WithRouteAccessHandler 设置路由访问处理器
type AuthOptions ¶
type AuthOptions struct {
AuthType string
LogicType LogicType
FailFunc func(w http.ResponseWriter, r *http.Request, err error)
BeforeAuthHandler BeforeAuthHandler
RouteAccessHandler RouteAccessHandler
}
AuthOptions defines middleware auth options AuthOptions 定义中间件认证选项
type AuthorizationCode ¶
type AuthorizationCode = oauth2.AuthorizationCode
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type Base64Serializer ¶
type Base64Serializer = base64codec.Base64Serializer
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type BeforeAuthHandler ¶
type BeforeAuthHandler func(w http.ResponseWriter, r *http.Request, req *AuthHandleRequest)
BeforeAuthHandler handles request before dtoken checks BeforeAuthHandler 在 dtoken 校验前处理请求
type ChiContext ¶
type ChiContext struct {
// contains filtered or unexported fields
}
ChiContext adapts request context ChiContext 适配 Chi 请求上下文
func (*ChiContext) Abort ¶
func (c *ChiContext) Abort()
Abort implements adapter.RequestContext Abort 实现 adapter.RequestContext 接口
func (*ChiContext) Get ¶
func (c *ChiContext) Get(key string) (interface{}, bool)
Get implements adapter.RequestContext Get 实现 adapter.RequestContext 接口
func (*ChiContext) GetBody ¶
func (c *ChiContext) GetBody() ([]byte, error)
GetBody implements adapter.RequestContext GetBody 实现 adapter.RequestContext 接口
func (*ChiContext) GetClientIP ¶
func (c *ChiContext) GetClientIP() string
GetClientIP implements adapter.RequestContext GetClientIP 实现 adapter.RequestContext 接口
func (*ChiContext) GetCookie ¶
func (c *ChiContext) GetCookie(key string) string
GetCookie implements adapter.RequestContext GetCookie 实现 adapter.RequestContext 接口
func (*ChiContext) GetHeader ¶
func (c *ChiContext) GetHeader(key string) string
GetHeader implements adapter.RequestContext GetHeader 实现 adapter.RequestContext 接口
func (*ChiContext) GetHeaders ¶
func (c *ChiContext) GetHeaders() map[string][]string
GetHeaders implements adapter.RequestContext GetHeaders 实现 adapter.RequestContext 接口
func (*ChiContext) GetMethod ¶
func (c *ChiContext) GetMethod() string
GetMethod implements adapter.RequestContext GetMethod 实现 adapter.RequestContext 接口
func (*ChiContext) GetPath ¶
func (c *ChiContext) GetPath() string
GetPath implements adapter.RequestContext GetPath 实现 adapter.RequestContext 接口
func (*ChiContext) GetPostForm ¶
func (c *ChiContext) GetPostForm(key string) string
GetPostForm implements adapter.RequestContext GetPostForm 实现 adapter.RequestContext 接口
func (*ChiContext) GetQuery ¶
func (c *ChiContext) GetQuery(key string) string
GetQuery implements adapter.RequestContext GetQuery 实现 adapter.RequestContext 接口
func (*ChiContext) GetQueryAll ¶
func (c *ChiContext) GetQueryAll() map[string][]string
GetQueryAll implements adapter.RequestContext GetQueryAll 实现 adapter.RequestContext 接口
func (*ChiContext) GetRawRequest ¶
func (c *ChiContext) GetRawRequest() *http.Request
GetRawRequest implements adapter.RequestContextExt GetRawRequest 实现 adapter.RequestContextExt 接口
func (*ChiContext) GetRawResponseWriter ¶
func (c *ChiContext) GetRawResponseWriter() http.ResponseWriter
GetRawResponseWriter implements adapter.RequestContextExt GetRawResponseWriter 实现 adapter.RequestContextExt 接口
func (*ChiContext) GetString ¶
func (c *ChiContext) GetString(key string) string
GetString implements adapter.RequestContext GetString 实现 adapter.RequestContext 接口
func (*ChiContext) GetURL ¶
func (c *ChiContext) GetURL() string
GetURL implements adapter.RequestContext GetURL 实现 adapter.RequestContext 接口
func (*ChiContext) GetUserAgent ¶
func (c *ChiContext) GetUserAgent() string
GetUserAgent implements adapter.RequestContext GetUserAgent 实现 adapter.RequestContext 接口
func (*ChiContext) IsAborted ¶
func (c *ChiContext) IsAborted() bool
IsAborted implements adapter.RequestContext IsAborted 实现 adapter.RequestContext 接口
func (*ChiContext) IsTLS ¶
func (c *ChiContext) IsTLS() bool
IsTLS implements adapter.RequestContext IsTLS 实现 adapter.RequestContext 接口
func (*ChiContext) JSON ¶
func (c *ChiContext) JSON(code int, v any) error
JSON implements adapter.RequestContextExt JSON 实现 adapter.RequestContextExt 接口
func (*ChiContext) MustGet ¶
func (c *ChiContext) MustGet(key string) any
MustGet implements adapter.RequestContext MustGet 实现 adapter.RequestContext 接口
func (*ChiContext) Set ¶
func (c *ChiContext) Set(key string, value interface{})
Set implements adapter.RequestContext Set 实现 adapter.RequestContext 接口
func (*ChiContext) SetCookie ¶
func (c *ChiContext) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool)
SetCookie implements adapter.RequestContext SetCookie 实现 adapter.RequestContext 接口
func (*ChiContext) SetCookieWithOptions ¶
func (c *ChiContext) SetCookieWithOptions(options *adapter.CookieOptions)
SetCookieWithOptions implements adapter.RequestContext SetCookieWithOptions 实现 adapter.RequestContext 接口
func (*ChiContext) SetHeader ¶
func (c *ChiContext) SetHeader(key, value string)
SetHeader implements adapter.RequestContext SetHeader 实现 adapter.RequestContext 接口
func (*ChiContext) SetStatusCode ¶
func (c *ChiContext) SetStatusCode(code int)
SetStatusCode implements adapter.RequestContext SetStatusCode 实现 adapter.RequestContext 接口
type CodecFactory ¶
type CodecFactory = builder.CodecFactory
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ComponentFactories ¶
type ComponentFactories = builder.ComponentFactories
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type Components ¶
type Components = builder.Components
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ConcurrencyScope ¶
type ConcurrencyScope = config.ConcurrencyScope
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type CookieConfig ¶
type CookieConfig = config.CookieConfig
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type CookieOptions ¶
type CookieOptions = adapter.CookieOptions
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type DTokenBuilder ¶
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type DTokenContext ¶
type DTokenContext = corecontext.DTokenContext
DTokenContext exposes request scoped DToken context DTokenContext 鏆撮湶璇锋眰绾?DToken 涓婁笅鏂囩被鍨嬨€?
type DTokenError ¶
type DTokenError = derror.DTokenError
DTokenError exposes the core DToken error type.
type DefaultGenerator ¶
type DefaultGenerator = dgenerator.Generator
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type DeviceDisableInfo ¶
type DeviceDisableInfo = manager.DeviceDisableInfo
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type DeviceDisableOptions ¶
type DeviceDisableOptions = dtoken.DeviceDisableOptions
Typed option aliases keep framework imports self-contained.
type DisableInfo ¶
type DisableInfo = manager.DisableInfo
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type DisableOptions ¶
type DisableOptions = dtoken.DisableOptions
Typed option aliases keep framework imports self-contained.
type EventFilter ¶
type EventFilter = listener.EventFilter
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type EventManager ¶
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type EventStats ¶
type EventStats = listener.EventStats
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type FullStorage ¶
type FullStorage = adapter.FullStorage
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type GeneratorFactory ¶
type GeneratorFactory = builder.GeneratorFactory
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type JSONSerializer ¶
type JSONSerializer = jsoncodec.JSONSerializer
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ListenerConfig ¶
type ListenerConfig = listener.ListenerConfig
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ListenerFunc ¶
type ListenerFunc = listener.ListenerFunc
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type LogControl ¶
type LogControl = adapter.LogControl
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type LogFactory ¶
type LogFactory = builder.LogFactory
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type LoggerConfig ¶
type LoggerConfig = dlog.LoggerConfig
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type LoginOptions ¶
type LoginOptions = dtoken.LoginOptions
Typed option aliases keep framework imports self-contained.
type LogoutMode ¶
type LogoutMode = config.LogoutMode
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type LogoutOptions ¶
type LogoutOptions = dtoken.LogoutOptions
Typed option aliases keep framework imports self-contained.
type ManagerOption ¶
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ManagerRefreshTokenOptions ¶ added in v0.0.3
type ManagerRefreshTokenOptions = manager.RefreshTokenOptions
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type MemoryStorage ¶
type MemoryStorage = memorystorage.Storage
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type MsgPackSerializer ¶
type MsgPackSerializer = msgpackcodec.MsgPackSerializer
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type NonceConfig ¶
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type NonceManager ¶
type NonceManager = nonce.NonceManager
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type OAuth2Client ¶
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type OAuth2Config ¶
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type OAuth2Server ¶
type OAuth2Server = oauth2.OAuth2Server
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type PermissionOptions ¶
type PermissionOptions = dtoken.PermissionOptions
Typed option aliases keep framework imports self-contained.
type PoolFactory ¶
type PoolFactory = builder.PoolFactory
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RedisConfig ¶
type RedisConfig = redisstorage.Config
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RedisStorage ¶
type RedisStorage = redisstorage.Storage
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RefreshTokenInfo ¶ added in v0.0.3
type RefreshTokenInfo = manager.RefreshTokenInfo
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RefreshTokenOptions ¶ added in v0.0.3
type RefreshTokenOptions = dtoken.RefreshTokenOptions
Typed option aliases keep framework imports self-contained.
type RefreshTokenPair ¶ added in v0.0.3
type RefreshTokenPair = manager.RefreshTokenPair
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RenewPoolConfig ¶
type RenewPoolConfig = ants.RenewPoolConfig
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RenewPoolManager ¶
type RenewPoolManager = ants.RenewPoolManager
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ReplacedLoginExitMode ¶
type ReplacedLoginExitMode = config.ReplacedLoginExitMode
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ReplacedLoginMode ¶
type ReplacedLoginMode = config.ReplacedLoginExitMode
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RequestContext ¶
type RequestContext = adapter.RequestContext
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RequestContextExt ¶
type RequestContextExt = adapter.RequestContextExt
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type RoleOptions ¶
type RoleOptions = dtoken.RoleOptions
Typed option aliases keep framework imports self-contained.
type RouteAccessHandler ¶ added in v0.0.3
type RouteAccessHandler func(w http.ResponseWriter, r *http.Request, req *RouteAccessRequest)
RouteAccessHandler resolves route auth, permission, and role rules RouteAccessHandler 解析路由认证、权限、角色规则
type RouteAccessRequest ¶ added in v0.0.3
type RouteAccessRequest struct {
AuthType string
LogicType LogicType
CheckDisable bool
Permissions []string
Roles []string
// contains filtered or unexported fields
}
RouteAccessRequest carries route access rules RouteAccessRequest 携带路由访问规则
func (*RouteAccessRequest) RequirePermissions ¶ added in v0.0.3
func (req *RouteAccessRequest) RequirePermissions(permissions ...string)
RequirePermissions appends required permissions RequirePermissions 追加当前路由所需权限
func (*RouteAccessRequest) RequireRoles ¶ added in v0.0.3
func (req *RouteAccessRequest) RequireRoles(roles ...string)
RequireRoles appends required roles RequireRoles 追加当前路由所需角色
func (*RouteAccessRequest) SetLogicType ¶ added in v0.0.3
func (req *RouteAccessRequest) SetLogicType(logicType LogicType)
SetLogicType sets permission and role logic type SetLogicType 设置权限和角色逻辑类型
func (*RouteAccessRequest) SkipAuth ¶ added in v0.0.3
func (req *RouteAccessRequest) SkipAuth()
SkipAuth skips login, permission, and role checks SkipAuth 跳过登录、权限、角色校验
func (*RouteAccessRequest) SkipPermission ¶ added in v0.0.3
func (req *RouteAccessRequest) SkipPermission()
SkipPermission skips permission and role checks after login SkipPermission 登录后跳过权限和角色校验
type SameSiteMode ¶
type SameSiteMode = config.SameSiteMode
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ScannerStorage ¶
type ScannerStorage = adapter.ScannerStorage
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ServiceDisableInfo ¶
type ServiceDisableInfo = manager.ServiceDisableInfo
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type ServiceDisableOptions ¶
type ServiceDisableOptions = dtoken.ServiceDisableOptions
Typed option aliases keep framework imports self-contained.
type StorageFactory ¶
type StorageFactory = builder.StorageFactory
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type TerminalInfo ¶
type TerminalInfo = manager.TerminalInfo
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type TerminalRemovalFunc ¶
type TerminalRemovalFunc = manager.TerminalRemovalFunc
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type TerminalVisitor ¶
type TerminalVisitor = manager.TerminalVisitor
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type TokenIntrospection ¶ added in v0.0.3
type TokenIntrospection = manager.TokenIntrospection
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type TokenRequest ¶
type TokenRequest = oauth2.TokenRequest
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type TokenState ¶
type TokenState = manager.TokenState
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type TokenStyle ¶
type TokenStyle = adapter.TokenStyle
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
type UserValidator ¶
type UserValidator = oauth2.UserValidator
Core aliases keep framework imports self-contained. Core 别名让框架包可以独立使用 dtoken。
Source Files
¶
- annotation.go
- api_export.go
- component_export.go
- context.go
- context_access_facade.go
- context_auth_facade.go
- context_cookie_facade.go
- context_disable_facade.go
- context_facade.go
- context_nonce_facade.go
- context_oauth2_facade.go
- context_refresh_facade.go
- context_session_facade.go
- context_shortkey_facade.go
- context_terminal_facade.go
- context_ticket_facade.go
- error_export.go
- export.go
- facade_export.go
- middleware.go