apiToken

package
v0.0.0-...-987a61a Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const API_TOKEN_USER_EMAIL_PREFIX = "API-TOKEN:"

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiToken

type ApiToken struct {
	Id           int    `sql:"id,pk"`
	UserId       int32  `sql:"user_id, notnull"`
	Name         string `sql:"name, notnull"`
	Description  string `sql:"description, notnull"`
	ExpireAtInMs int64  `sql:"expire_at_in_ms"`
	Token        string `sql:"token, notnull"`
	User         *repository.UserModel
	sql.AuditLog
	// contains filtered or unexported fields
}

type ApiTokenCustomClaims

type ApiTokenCustomClaims struct {
	Email string `json:"email"`
	jwt.RegisteredClaims
}

type ApiTokenRepository

type ApiTokenRepository interface {
	Save(apiToken *ApiToken) error
	Update(apiToken *ApiToken) error
	FindAllActive() ([]*ApiToken, error)
	FindActiveById(id int) (*ApiToken, error)
	FindByName(name string) (*ApiToken, error)
}

type ApiTokenRepositoryImpl

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

func NewApiTokenRepositoryImpl

func NewApiTokenRepositoryImpl(dbConnection *pg.DB) *ApiTokenRepositoryImpl

func (ApiTokenRepositoryImpl) FindActiveById

func (impl ApiTokenRepositoryImpl) FindActiveById(id int) (*ApiToken, error)

func (ApiTokenRepositoryImpl) FindAllActive

func (impl ApiTokenRepositoryImpl) FindAllActive() ([]*ApiToken, error)

func (ApiTokenRepositoryImpl) FindByName

func (impl ApiTokenRepositoryImpl) FindByName(name string) (*ApiToken, error)

func (ApiTokenRepositoryImpl) Save

func (impl ApiTokenRepositoryImpl) Save(apiToken *ApiToken) error

func (ApiTokenRepositoryImpl) Update

func (impl ApiTokenRepositoryImpl) Update(apiToken *ApiToken) error

type ApiTokenSecretService

type ApiTokenSecretService interface {
	GetApiTokenSecretByteArr() ([]byte, error)
}

type ApiTokenSecretServiceImpl

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

func NewApiTokenSecretServiceImpl

func NewApiTokenSecretServiceImpl(logger *zap.SugaredLogger, attributesService attributes.AttributesService, apiTokenSecretStore *apiTokenAuth.ApiTokenSecretStore) (*ApiTokenSecretServiceImpl, error)

func (ApiTokenSecretServiceImpl) GetApiTokenSecretByteArr

func (impl ApiTokenSecretServiceImpl) GetApiTokenSecretByteArr() ([]byte, error)

type ApiTokenService

type ApiTokenService interface {
	GetAllActiveApiTokens() ([]*openapi.ApiToken, error)
	CreateApiToken(request *openapi.CreateApiTokenRequest, createdBy int32) (*openapi.CreateApiTokenResponse, error)
	UpdateApiToken(apiTokenId int, request *openapi.UpdateApiTokenRequest, updatedBy int32) (*openapi.UpdateApiTokenResponse, error)
	DeleteApiToken(apiTokenId int, deletedBy int32) (*openapi.ActionResponse, error)
}

type ApiTokenServiceImpl

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

func NewApiTokenServiceImpl

func NewApiTokenServiceImpl(logger *zap.SugaredLogger, apiTokenSecretService ApiTokenSecretService, userService user.UserService, userAuditService user.UserAuditService,
	apiTokenRepository ApiTokenRepository) *ApiTokenServiceImpl

func (ApiTokenServiceImpl) CreateApiToken

func (impl ApiTokenServiceImpl) CreateApiToken(request *openapi.CreateApiTokenRequest, createdBy int32) (*openapi.CreateApiTokenResponse, error)

func (ApiTokenServiceImpl) DeleteApiToken

func (impl ApiTokenServiceImpl) DeleteApiToken(apiTokenId int, deletedBy int32) (*openapi.ActionResponse, error)

func (ApiTokenServiceImpl) GetAllActiveApiTokens

func (impl ApiTokenServiceImpl) GetAllActiveApiTokens() ([]*openapi.ApiToken, error)

func (ApiTokenServiceImpl) UpdateApiToken

func (impl ApiTokenServiceImpl) UpdateApiToken(apiTokenId int, request *openapi.UpdateApiTokenRequest, updatedBy int32) (*openapi.UpdateApiTokenResponse, error)

Jump to

Keyboard shortcuts

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