Documentation
¶
Index ¶
- func CheckDisable(tokenValue string) error
- func CheckLogin(tokenValue string) error
- func CheckPermission(tokenValue string, permission string) error
- func CheckPermissionAnd(tokenValue string, permissions []string) error
- func CheckPermissionOr(tokenValue string, permissions []string) error
- func CheckRole(tokenValue string, role string) error
- func CheckRoleAnd(tokenValue string, roles []string) error
- func CheckRoleOr(tokenValue string, roles []string) error
- func CloseManager()
- func DeleteSession(loginID interface{}) error
- func Disable(loginID interface{}, duration time.Duration) error
- func GenerateNonce() (string, error)
- func GetDisableTime(loginID interface{}) (int64, error)
- func GetLoginID(tokenValue string) (string, error)
- func GetLoginIDNotCheck(tokenValue string) (string, error)
- func GetManager() *manager.Manager
- func GetOAuth2Server() *oauth2.OAuth2Server
- func GetPermissionList(tokenValue string) ([]string, error)
- func GetPermissions(loginID interface{}) ([]string, error)
- func GetRoleList(tokenValue string) ([]string, error)
- func GetRoles(loginID interface{}) ([]string, error)
- func GetSession(loginID interface{}) (*session.Session, error)
- func GetSessionByToken(tokenValue string) (*session.Session, error)
- func GetSessionCount(loginID interface{}) (int, error)
- func GetTokenInfo(tokenValue string) (*manager.TokenInfo, error)
- func GetTokenSession(tokenValue string) (*session.Session, error)
- func GetTokenTag(tokenValue string) (string, error)
- func GetTokenValue(loginID interface{}, device ...string) (string, error)
- func GetTokenValueList(loginID interface{}) ([]string, error)
- func HasPermission(loginID interface{}, permission string) bool
- func HasPermissionsAnd(loginID interface{}, permissions []string) bool
- func HasPermissionsOr(loginID interface{}, permissions []string) bool
- func HasRole(loginID interface{}, role string) bool
- func HasRolesAnd(loginID interface{}, roles []string) bool
- func HasRolesOr(loginID interface{}, roles []string) bool
- 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 LoginWithRefreshToken(loginID interface{}, device ...string) (*security.RefreshTokenInfo, error)
- func Logout(loginID interface{}, device ...string) error
- func LogoutByToken(tokenValue string) error
- func RefreshAccessToken(refreshToken string) (*security.RefreshTokenInfo, error)
- func RevokeRefreshToken(refreshToken string) error
- func SetManager(mgr *manager.Manager)
- func SetPermissions(loginID interface{}, permissions []string) error
- func SetRoles(loginID interface{}, roles []string) error
- func SetTokenTag(tokenValue, tag string) error
- func Untie(loginID interface{}) error
- func VerifyNonce(nonce string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDisable ¶
CheckDisable checks if the account associated with the token is disabled | 检查Token对应账号是否被封禁
func CheckLogin ¶
CheckLogin checks login status (throws error if not logged in) | 检查登录状态(未登录抛出错误)
func CheckPermission ¶
CheckPermission checks if the token has the specified permission | 检查Token是否拥有指定权限
func CheckPermissionAnd ¶
CheckPermissionAnd checks if the token has all specified permissions | 检查Token是否拥有所有指定权限
func CheckPermissionOr ¶
CheckPermissionOr checks if the token has any of the specified permissions | 检查Token是否拥有任一指定权限
func CheckRoleAnd ¶
CheckRoleAnd checks if the token has all specified roles | 检查Token是否拥有所有指定角色
func CheckRoleOr ¶
CheckRoleOr checks if the token has any of the specified roles | 检查Token是否拥有任一指定角色
func CloseManager ¶
func CloseManager()
CloseManager closes global Manager and releases resources | 关闭全局 Manager 并释放资源
func DeleteSession ¶
func DeleteSession(loginID interface{}) error
DeleteSession deletes a session | 删除Session
func GenerateNonce ¶
func GetDisableTime ¶
GetDisableTime gets remaining disable time in seconds | 获取剩余封禁时间(秒)
func GetLoginID ¶
GetLoginID gets the login ID from token | 从Token获取登录ID
func GetLoginIDNotCheck ¶
GetLoginIDNotCheck gets login ID without checking | 获取登录ID(不检查)
func GetManager ¶
GetManager gets the global Manager | 获取全局Manager
func GetOAuth2Server ¶
func GetOAuth2Server() *oauth2.OAuth2Server
func GetPermissionList ¶
GetPermissionList gets permission list for the token | 获取Token对应的权限列表
func GetPermissions ¶
GetPermissions gets permission list | 获取权限列表
func GetRoleList ¶
GetRoleList gets role list for the token | 获取Token对应的角色列表
func GetSession ¶
GetSession gets session by login ID | 根据登录ID获取Session
func GetSessionByToken ¶
GetSessionByToken gets session by token | 根据Token获取Session
func GetSessionCount ¶
GetSessionCount 获取指定账号的Session数量
func GetTokenInfo ¶
GetTokenInfo gets token information | 获取Token信息
func GetTokenSession ¶
GetTokenSession gets session for the token | 获取Token对应的Session
func GetTokenValue ¶
GetTokenValue gets the token value for a login ID | 获取登录ID对应的Token值
func GetTokenValueList ¶
GetTokenValueList 获取指定账号的所有Token
func HasPermission ¶
HasPermission checks if has specified permission | 检查是否拥有指定权限
func HasPermissionsAnd ¶
HasPermissionsAnd checks if has all permissions (AND logic) | 检查是否拥有所有权限(AND逻辑)
func HasPermissionsOr ¶
HasPermissionsOr checks if has any permission (OR logic) | 检查是否拥有任一权限(OR逻辑)
func HasRolesAnd ¶
HasRolesAnd checks if has all roles (AND logic) | 检查是否拥有所有角色(AND逻辑)
func HasRolesOr ¶
HasRolesOr 检查是否拥有任一角色(OR)
func IsDisable ¶
func IsDisable(loginID interface{}) bool
IsDisable checks if an account is disabled | 检查账号是否被封禁
func LoginByToken ¶
LoginByToken performs login with specified token | 使用指定Token登录
func LoginWithRefreshToken ¶
func LoginWithRefreshToken(loginID interface{}, device ...string) (*security.RefreshTokenInfo, error)
func LogoutByToken ¶
LogoutByToken performs logout by token | 根据Token登出
func RefreshAccessToken ¶
func RefreshAccessToken(refreshToken string) (*security.RefreshTokenInfo, error)
func RevokeRefreshToken ¶
func SetManager ¶
SetManager sets the global Manager (must be called first) | 设置全局Manager(必须先调用此方法)
func SetPermissions ¶
SetPermissions sets permissions for a login ID | 设置用户权限
func VerifyNonce ¶
Types ¶
This section is empty.