service

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

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupportOauthProvider = response.NewResponseError(401, "not supported openid provider")
	ErrNotSupportGrantType     = response.NewResponseError(401, "not supported grant type")
	ErrInvalidTpAccessToken    = response.NewResponseError(401, "invalid trusted third party access token")
	ErrInvalidCredential       = response.NewResponseError(401, "invalid credential")
	ErrCredentialAlreadyExist  = response.NewResponseError(409, "crendential already exist")
	ErrInvalidClientId         = response.NewResponseError(401, "invalid client id")
	ErrUnauthorizedAccess      = response.NewResponseError(401, "unauthorized access")
)
View Source
var ErrMissingValue = errors.New("missing value")

Functions

This section is empty.

Types

type Auth

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

func NewAuthService

func NewAuthService(db *gorm.DB, configService *Config, userInfoClient client.IUserInfo) *Auth

func (*Auth) Activate

func (s *Auth) Activate(userId string) error

func (*Auth) CheckPermission

func (s *Auth) CheckPermission() error

func (*Auth) GrantAccess

func (s *Auth) GrantAccess(authentication *dto.Authentication) (*dto.GrantAccess, error)

func (*Auth) Login

func (s *Auth) Login(grantRequest *dto.GrantRequest) (*dto.Authentication, error)

func (*Auth) Logout

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

func (*Auth) Register

func (s *Auth) Register(registerRequest *dto.GrantRequest) (*dto.Authentication, error)

type Config

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

func NewConfigService

func NewConfigService(db *gorm.DB) *Config

func (*Config) Get

func (s *Config) Get(key string) (*string, error)

func (*Config) GetInNs

func (s *Config) GetInNs(namespace *string, key string) (*string, error)

func (*Config) GetInNsOrDefault

func (s *Config) GetInNsOrDefault(namespace *string, key string, defaultValue string) string

func (*Config) GetOrDefault

func (s *Config) GetOrDefault(key string, defaultValue string) string

func (*Config) MustHave

func (s *Config) MustHave(key string) (string, error)

func (*Config) MustHaveInNs

func (s *Config) MustHaveInNs(namespace string, key string) (string, error)

type Mail

type Mail struct {
	Host     string
	Port     string
	FromAddr string
	// contains filtered or unexported fields
}

func NewMailService

func NewMailService(username, password, host, fromAddr string, port int) *Mail

func (*Mail) SendMail

func (s *Mail) SendMail(toAddrs []string, msg string) error

type Redis

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

func NewRedisClient

func NewRedisClient(configService *Config) *Redis

func (*Redis) Get

func (s *Redis) Get(ctx context.Context, namespace string, key string) (string, error)

type TrustedTpInfoFetcher

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

Jump to

Keyboard shortcuts

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