biz

package
v0.0.0-...-7bafd44 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupportOauthProvider = util.NewGroupError(ErrLoginDetailErrorGroup, errors.New(401, "not supported openid provider", "not supported openid provider"))
	ErrNotSupportGrantType     = util.NewGroupError(ErrLoginDetailErrorGroup, errors.New(401, "not supported grant type", "not supported grant type"))
	ErrInvalidTpAccessToken    = util.NewGroupError(ErrLoginDetailErrorGroup, errors.New(401, "invalid trusted third party access token", "invalid trusted third party access token"))
	ErrInvalidCredential       = util.NewGroupError(ErrLoginDetailErrorGroup, errors.New(401, "invalid credential", "invalid credential"))
	ErrCredentialAlreadyExist  = util.NewGroupError(ErrLoginDetailErrorGroup, errors.New(409, "crendential already exist", "crendential already exist"))
	ErrInvalidClientId         = util.NewGroupError(ErrLoginDetailErrorGroup, errors.New(401, "invalid client id", "invalid client id"))
	ErrUnauthorizedAccess      = util.NewGroupError(ErrLoginDetailErrorGroup, errors.New(401, "unauthorized access", "unauthorized access"))
)
View Source
var ErrLoginDetailErrorGroup = stderrors.New("login detail error group")

Login detail error group

View Source
var ErrResourceAlreadyExists = stderrors.New("resource already exists")

Standard errors

View Source
var ErrResourceNotFound = stderrors.New("resource not found")
View Source
var ErrUserInfoClientGroup = stderrors.New("user info client group")

User info client error group

ProviderSet is biz providers.

Functions

func Query

func Query[T any](txManager TransactionManager, queryFn func() (T, error)) (T, error)

Types

type ClientRepo

type ClientRepo interface {
	FindByClientID(clientId string) (*Client, error)
}

type LoginDetailUsecase

type LoginDetailUsecase struct {
	TransactionManager
	// contains filtered or unexported fields
}

func NewLoginDetailUseCase

func NewLoginDetailUseCase(userInfoClient UserInfoClient, repo LoginDetailRepo, clientRepo ClientRepo, refreshTokenRepo RefreshTokenRepo, logger log.Logger, transactionManager TransactionManager) *LoginDetailUsecase

func (*LoginDetailUsecase) Activate

func (s *LoginDetailUsecase) Activate(id string) error

func (*LoginDetailUsecase) CheckPermission

func (s *LoginDetailUsecase) CheckPermission() error

TODO: Implement this method

func (*LoginDetailUsecase) FindClient

func (s *LoginDetailUsecase) FindClient(clientId string) (*Client, error)

func (*LoginDetailUsecase) GenerateAccessToken

func (s *LoginDetailUsecase) GenerateAccessToken(refreshToken *RefreshToken) (string, error)

func (*LoginDetailUsecase) GrantAccess

func (s *LoginDetailUsecase) GrantAccess(authentication *Authentication) (*GrantAccess, error)

func (*LoginDetailUsecase) Login

func (s *LoginDetailUsecase) Login(grantRequest *GrantRequest) (*Authentication, error)

func (*LoginDetailUsecase) Logout

func (s *LoginDetailUsecase) Logout(refreshToken string) error

func (*LoginDetailUsecase) Register

func (s *LoginDetailUsecase) Register(registerRequest *GrantRequest) (*Authentication, error)

type RefreshTokenRepo

type RefreshTokenRepo interface {
	Save(*RefreshToken) (*RefreshToken, error)
	DeleteById(id string) error
	FindById(id string) (*RefreshToken, error)
}

type TransactionManager

type TransactionManager interface {
	Run(func() error) error
}

type TrustedTpInfoFetcher

type TrustedTpInfoFetcher func(accessToken string) (*UserInfo, error)

type UserInfo

type UserInfo struct {
	Id        uuid.UUID `gorm:"type:uuid;default:gen_random_uuid()"`
	UserId    string
	Password  string
	Activated bool
}

type UserInfoRepo

type UserInfoRepo interface {
	Save(*UserInfo) (*UserInfo, error)
	FindByID(uuid.UUID) (*UserInfo, error)
	FindById(userId string) (*UserInfo, error)
}

Jump to

Keyboard shortcuts

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