auth

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 13 Imported by: 85

Documentation

Index

Constants

View Source
const ServiceName = "UserAuthTokenService"

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeUserAuthTokenService

type FakeUserAuthTokenService struct {
	CreateTokenProvider          func(ctx context.Context, user *models.User, clientIP net.IP, userAgent string) (*models.UserToken, error)
	TryRotateTokenProvider       func(ctx context.Context, token *models.UserToken, clientIP net.IP, userAgent string) (bool, error)
	LookupTokenProvider          func(ctx context.Context, unhashedToken string) (*models.UserToken, error)
	RevokeTokenProvider          func(ctx context.Context, token *models.UserToken, soft bool) error
	RevokeAllUserTokensProvider  func(ctx context.Context, userId int64) error
	ActiveAuthTokenCount         func(ctx context.Context) (int64, error)
	GetUserTokenProvider         func(ctx context.Context, userId, userTokenId int64) (*models.UserToken, error)
	GetUserTokensProvider        func(ctx context.Context, userId int64) ([]*models.UserToken, error)
	GetUserRevokedTokensProvider func(ctx context.Context, userId int64) ([]*models.UserToken, error)
	BatchRevokedTokenProvider    func(ctx context.Context, userIds []int64) error
}

func NewFakeUserAuthTokenService

func NewFakeUserAuthTokenService() *FakeUserAuthTokenService

func (*FakeUserAuthTokenService) ActiveTokenCount

func (s *FakeUserAuthTokenService) ActiveTokenCount(ctx context.Context) (int64, error)

func (*FakeUserAuthTokenService) BatchRevokeAllUserTokens

func (s *FakeUserAuthTokenService) BatchRevokeAllUserTokens(ctx context.Context, userIds []int64) error

func (*FakeUserAuthTokenService) CreateToken

func (s *FakeUserAuthTokenService) CreateToken(ctx context.Context, user *models.User, clientIP net.IP, userAgent string) (*models.UserToken, error)

func (*FakeUserAuthTokenService) GetUserRevokedTokens

func (s *FakeUserAuthTokenService) GetUserRevokedTokens(ctx context.Context, userId int64) ([]*models.UserToken, error)

func (*FakeUserAuthTokenService) GetUserToken

func (s *FakeUserAuthTokenService) GetUserToken(ctx context.Context, userId, userTokenId int64) (*models.UserToken, error)

func (*FakeUserAuthTokenService) GetUserTokens

func (s *FakeUserAuthTokenService) GetUserTokens(ctx context.Context, userId int64) ([]*models.UserToken, error)

func (*FakeUserAuthTokenService) Init

func (s *FakeUserAuthTokenService) Init() error

Init initializes the service. Required for dependency injection.

func (*FakeUserAuthTokenService) LookupToken

func (s *FakeUserAuthTokenService) LookupToken(ctx context.Context, unhashedToken string) (*models.UserToken, error)

func (*FakeUserAuthTokenService) RevokeAllUserTokens

func (s *FakeUserAuthTokenService) RevokeAllUserTokens(ctx context.Context, userId int64) error

func (*FakeUserAuthTokenService) RevokeToken

func (s *FakeUserAuthTokenService) RevokeToken(ctx context.Context, token *models.UserToken, soft bool) error

func (*FakeUserAuthTokenService) TryRotateToken

func (s *FakeUserAuthTokenService) TryRotateToken(ctx context.Context, token *models.UserToken, clientIP net.IP,
	userAgent string) (bool, error)

type UserAuthTokenService

type UserAuthTokenService struct {
	SQLStore          *sqlstore.SQLStore
	ServerLockService *serverlock.ServerLockService
	Cfg               *setting.Cfg
	// contains filtered or unexported fields
}

func ProvideUserAuthTokenService

func ProvideUserAuthTokenService(sqlStore *sqlstore.SQLStore, serverLockService *serverlock.ServerLockService,
	cfg *setting.Cfg) *UserAuthTokenService

func (*UserAuthTokenService) ActiveTokenCount

func (s *UserAuthTokenService) ActiveTokenCount(ctx context.Context) (int64, error)

func (*UserAuthTokenService) BatchRevokeAllUserTokens

func (s *UserAuthTokenService) BatchRevokeAllUserTokens(ctx context.Context, userIds []int64) error

func (*UserAuthTokenService) CreateToken

func (s *UserAuthTokenService) CreateToken(ctx context.Context, user *models.User, clientIP net.IP, userAgent string) (*models.UserToken, error)

func (*UserAuthTokenService) GetUserRevokedTokens

func (s *UserAuthTokenService) GetUserRevokedTokens(ctx context.Context, userId int64) ([]*models.UserToken, error)

func (*UserAuthTokenService) GetUserToken

func (s *UserAuthTokenService) GetUserToken(ctx context.Context, userId, userTokenId int64) (*models.UserToken, error)

func (*UserAuthTokenService) GetUserTokens

func (s *UserAuthTokenService) GetUserTokens(ctx context.Context, userId int64) ([]*models.UserToken, error)

func (*UserAuthTokenService) LookupToken

func (s *UserAuthTokenService) LookupToken(ctx context.Context, unhashedToken string) (*models.UserToken, error)

func (*UserAuthTokenService) RevokeAllUserTokens

func (s *UserAuthTokenService) RevokeAllUserTokens(ctx context.Context, userId int64) error

func (*UserAuthTokenService) RevokeToken

func (s *UserAuthTokenService) RevokeToken(ctx context.Context, token *models.UserToken, soft bool) error

func (*UserAuthTokenService) Run

func (*UserAuthTokenService) TryRotateToken

func (s *UserAuthTokenService) TryRotateToken(ctx context.Context, token *models.UserToken,
	clientIP net.IP, userAgent string) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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