auth

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepo

type AuthRepo interface {
	GetUserCacheInfo(ctx context.Context, accessToken string) (userInfo *entity.UserCacheInfo, err error)
	SetUserCacheInfo(ctx context.Context, accessToken, visitToken string, userInfo *entity.UserCacheInfo) error
	GetUserVisitCacheInfo(ctx context.Context, visitToken string) (accessToken string, err error)
	RemoveUserCacheInfo(ctx context.Context, accessToken string) (err error)
	RemoveUserVisitCacheInfo(ctx context.Context, visitToken string) (err error)
	SetUserStatus(ctx context.Context, userID string, userInfo *entity.UserCacheInfo) (err error)
	GetUserStatus(ctx context.Context, userID string) (userInfo *entity.UserCacheInfo, err error)
	RemoveUserStatus(ctx context.Context, userID string) (err error)
	GetAdminUserCacheInfo(ctx context.Context, accessToken string) (userInfo *entity.UserCacheInfo, err error)
	SetAdminUserCacheInfo(ctx context.Context, accessToken string, userInfo *entity.UserCacheInfo) error
	RemoveAdminUserCacheInfo(ctx context.Context, accessToken string) (err error)
	AddUserTokenMapping(ctx context.Context, userID, accessToken string) (err error)
	RemoveUserTokens(ctx context.Context, userID string, remainToken string)
}

AuthRepo auth repository

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

AuthService kit service

func NewAuthService

func NewAuthService(authRepo AuthRepo) *AuthService

NewAuthService email service

func (*AuthService) AddUserTokenMapping

func (as *AuthService) AddUserTokenMapping(ctx context.Context, userID, accessToken string) (err error)

AddUserTokenMapping add user token mapping

func (*AuthService) CheckUserVisitToken

func (as *AuthService) CheckUserVisitToken(ctx context.Context, visitToken string) bool

func (*AuthService) GetAdminUserCacheInfo

func (as *AuthService) GetAdminUserCacheInfo(ctx context.Context, accessToken string) (userInfo *entity.UserCacheInfo, err error)

func (*AuthService) GetUserCacheInfo

func (as *AuthService) GetUserCacheInfo(ctx context.Context, accessToken string) (userInfo *entity.UserCacheInfo, err error)

func (*AuthService) RemoveAdminUserCacheInfo

func (as *AuthService) RemoveAdminUserCacheInfo(ctx context.Context, accessToken string) (err error)

func (*AuthService) RemoveTokensExceptCurrentUser

func (as *AuthService) RemoveTokensExceptCurrentUser(ctx context.Context, userID string, accessToken string)

RemoveTokensExceptCurrentUser remove all tokens except the current user

func (*AuthService) RemoveUserAllTokens

func (as *AuthService) RemoveUserAllTokens(ctx context.Context, userID string)

RemoveUserAllTokens Log out all users under this user id

func (*AuthService) RemoveUserCacheInfo

func (as *AuthService) RemoveUserCacheInfo(ctx context.Context, accessToken string) (err error)

func (*AuthService) RemoveUserVisitCacheInfo

func (as *AuthService) RemoveUserVisitCacheInfo(ctx context.Context, visitToken string) (err error)

func (*AuthService) SetAdminUserCacheInfo

func (as *AuthService) SetAdminUserCacheInfo(ctx context.Context, accessToken string, userInfo *entity.UserCacheInfo) (err error)

func (*AuthService) SetUserCacheInfo

func (as *AuthService) SetUserCacheInfo(ctx context.Context, userInfo *entity.UserCacheInfo) (
	accessToken string, visitToken string, err error)

func (*AuthService) SetUserStatus

func (as *AuthService) SetUserStatus(ctx context.Context, userInfo *entity.UserCacheInfo) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL