service

package
v0.0.0-...-4eea697 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	Infra *infrastructure.Infra
	Proc  *processing.Proc
	Cache *cache.Cache
}

func NewService

func NewService(infra *infrastructure.Infra, p *processing.Proc) *Service

func (*Service) AddTokenInBlackList

func (s *Service) AddTokenInBlackList(tokenRaw string, expires int64)

func (*Service) CreateToken

func (s *Service) CreateToken(userID string) (*TokenDetails, error)

func (*Service) ExtractToken

func (s *Service) ExtractToken(bearToken string) string

func (*Service) ExtractTokenMetadata

func (s *Service) ExtractTokenMetadata(token *jwt.Token) (*TokenClaims, error)

func (*Service) GetTokenHash

func (s *Service) GetTokenHash(tokenRaw string) [32]byte

func (*Service) GroupAddUser

func (s *Service) GroupAddUser(ctx context.Context, userID, systemID, addUserID, addSystemID, reqID string, level access.Level, groupID *uuid.UUID) error

func (*Service) GroupCreate

func (s *Service) GroupCreate(ctx context.Context, req proc.RequestInterface, userID, systemID, groupName, groupDescription string) (*model.UserGroup, error)

func (*Service) GroupGetByID

func (s *Service) GroupGetByID(ctx context.Context, userID, systemID string, groupID *uuid.UUID, groupKey *chachaPoly.Key) (*model.UserGroup, error)

func (*Service) GroupGetList

func (s *Service) GroupGetList(ctx context.Context, userID, systemID string) ([]*model.UserGroup, error)

func (*Service) GroupRemoveUser

func (s *Service) GroupRemoveUser(ctx context.Context, userID, systemID, removeUserID, removeSystemID, reqID string, groupID *uuid.UUID) error

func (*Service) Info

func (s *Service) Info(ctx context.Context, userID, systemID string) (*model.UserInfo, error)

func (*Service) InfoByCode

func (s *Service) InfoByCode(ctx context.Context, code int) (*model.UserInfo, error)

func (*Service) IsTokenInBlackList

func (s *Service) IsTokenInBlackList(tokenRaw string) bool

func (*Service) Login

func (s *Service) Login(ctx context.Context, userID, systemID, password string) (err error)

func (*Service) NewProcRequest

func (s *Service) NewProcRequest(reqID, userID string, kind processing.RequestKind) (processing.RequestInterface, error)

func (*Service) Register

func (s *Service) Register(ctx context.Context, user *model.UserCreateRequest, systemID, reqID string) (err error)

func (*Service) VerifyAccess

func (s *Service) VerifyAccess(userID, tokenString string) error

func (*Service) VerifyAndGetTokenDetails

func (s *Service) VerifyAndGetTokenDetails(userID, accessToken, refreshToken string) (*TokenDetails, error)

func (*Service) VerifyToken

func (s *Service) VerifyToken(userID, tokenString string, tokenType TokenType) (*jwt.Token, error)

type TokenClaims

type TokenClaims struct {
	TokenType TokenType `json:"type"`
	jwt.StandardClaims
}

type TokenDetails

type TokenDetails struct {
	AccessToken  string
	RefreshToken string
	AtExpires    int64
	RtExpires    int64
}

type TokenType

type TokenType uint8
const (
	TokenAccessType TokenType = iota
	TokenRefreshType
)

Jump to

Keyboard shortcuts

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