clientauth

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound              = errors.New("resource not found")
	ErrConflict              = errors.New("resource conflict")
	ErrAuthorizationPending  = errors.New("authorization pending")
	ErrSlowDown              = errors.New("slow down")
	ErrExpiredToken          = errors.New("expired token")
	ErrAccessDenied          = errors.New("access denied")
	ErrInvalidRequest        = errors.New("invalid request")
	ErrUnauthorized          = errors.New("unauthorized")
	ErrTooManyRequests       = errors.New("too many requests")
	ErrTransactorNotProvided = errors.New("transactor not configured")
)

Functions

This section is empty.

Types

type PGXTransactor

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

func NewPGXTransactor

func NewPGXTransactor(pool *pgxpool.Pool) *PGXTransactor

func (*PGXTransactor) InTx

func (t *PGXTransactor) InTx(ctx context.Context, fn func(q Querier) error) error

type Querier

type Querier interface {
	CreateAuthDeviceAuthorization(ctx context.Context, arg db.CreateAuthDeviceAuthorizationParams) (db.AuthDeviceAuthorization, error)
	GetAuthDeviceAuthorizationByDeviceCode(ctx context.Context, arg db.GetAuthDeviceAuthorizationByDeviceCodeParams) (db.AuthDeviceAuthorization, error)
	GetAuthDeviceAuthorizationByUserCode(ctx context.Context, arg db.GetAuthDeviceAuthorizationByUserCodeParams) (db.AuthDeviceAuthorization, error)
	UpdateAuthDeviceAuthorizationStatus(ctx context.Context, arg db.UpdateAuthDeviceAuthorizationStatusParams) (db.AuthDeviceAuthorization, error)
	CreateAuthSession(ctx context.Context, arg db.CreateAuthSessionParams) (db.AuthSession, error)
	GetAuthSessionByRefreshTokenHash(ctx context.Context, arg db.GetAuthSessionByRefreshTokenHashParams) (db.AuthSession, error)
	GetUserByID(ctx context.Context, arg db.GetUserByIDParams) (db.User, error)
	RevokeAuthSession(ctx context.Context, arg db.RevokeAuthSessionParams) (db.AuthSession, error)
	RevokeAuthSessionFamily(ctx context.Context, arg db.RevokeAuthSessionFamilyParams) (int64, error)
	CreateAuditLog(ctx context.Context, arg db.CreateAuditLogParams) (db.AuditLog, error)
}

type Service

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

func NewService

func NewService(cfg config.Config, queries Querier, tx Transactor) *Service

func (*Service) ApproveDeviceCode

func (s *Service) ApproveDeviceCode(ctx context.Context, userCode string, user db.User) error

func (*Service) CreateDeviceCode

func (s *Service) CreateDeviceCode(ctx context.Context, request *api.DeviceCodeCreateRequest) (*api.DeviceCode, error)

func (*Service) DenyDeviceCode

func (s *Service) DenyDeviceCode(ctx context.Context, userCode string, user db.User) error

func (*Service) ExchangeDeviceCode

func (s *Service) ExchangeDeviceCode(ctx context.Context, request api.DeviceCodeTokenRequest, userAgent string) (*api.TokenResponse, error)

func (*Service) Logout

func (s *Service) Logout(ctx context.Context, request api.LogoutRequest) error

func (*Service) RefreshAccessToken

func (s *Service) RefreshAccessToken(ctx context.Context, request api.RefreshTokenRequest, userAgent string) (*api.TokenResponse, error)

type Transactor

type Transactor interface {
	InTx(ctx context.Context, fn func(q Querier) error) error
}

type ValidationError

type ValidationError struct {
	Message string
}

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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