mysql

package
v0.0.0-...-6653ad0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenStorage

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

func NewTokenStorage

func NewTokenStorage(db *sql.DB) *TokenStorage

func (*TokenStorage) CreateAccessToken

func (s *TokenStorage) CreateAccessToken(ctx context.Context, userID int64, token, chain string, valid bool) error

func (*TokenStorage) CreateRefreshToken

func (s *TokenStorage) CreateRefreshToken(ctx context.Context, userID int64, token, chain string, valid bool) error

func (*TokenStorage) GetAccessToken

func (s *TokenStorage) GetAccessToken(ctx context.Context, userID int64, token string) (papers.Token, error)

func (*TokenStorage) GetRefreshToken

func (s *TokenStorage) GetRefreshToken(ctx context.Context, userID int64, token string) (papers.Token, error)

func (*TokenStorage) InvalidateAccessTokens

func (s *TokenStorage) InvalidateAccessTokens(ctx context.Context, userID int64) error

func (*TokenStorage) InvalidateRefreshToken

func (s *TokenStorage) InvalidateRefreshToken(ctx context.Context, userID int64, token string) error

func (*TokenStorage) InvalidateRefreshTokens

func (s *TokenStorage) InvalidateRefreshTokens(ctx context.Context, userID int64) error

func (*TokenStorage) InvalidateTokenChain

func (s *TokenStorage) InvalidateTokenChain(ctx context.Context, userID int64, chain string) error

func (*TokenStorage) PruneAccessTokens

func (s *TokenStorage) PruneAccessTokens(ctx context.Context, timeToStale time.Duration) error

func (*TokenStorage) PruneRefreshTokens

func (s *TokenStorage) PruneRefreshTokens(ctx context.Context, timeToStale time.Duration) error

type User

type User struct {
	gen.User

	Roles []string
}

func (*User) GetAttempts

func (u *User) GetAttempts() int

func (*User) GetConfirmToken

func (u *User) GetConfirmToken() string

func (*User) GetConfirmed

func (u *User) GetConfirmed() bool

func (*User) GetCreatedAt

func (u *User) GetCreatedAt() time.Time

func (*User) GetEmail

func (u *User) GetEmail() string

func (*User) GetID

func (u *User) GetID() int64

func (*User) GetLastAttempt

func (u *User) GetLastAttempt() time.Time

func (*User) GetLastLogin

func (u *User) GetLastLogin() time.Time

func (*User) GetLockedUntil

func (u *User) GetLockedUntil() time.Time

func (*User) GetPassword

func (u *User) GetPassword() string

func (*User) GetRecoveryToken

func (u *User) GetRecoveryToken() string

func (*User) GetRoles

func (u *User) GetRoles() []string

func (*User) GetTOTPSecret

func (u *User) GetTOTPSecret() string

func (*User) GetUsername

func (u *User) GetUsername() string

func (*User) SetAttempts

func (u *User) SetAttempts(attempts int)

func (*User) SetConfirmToken

func (u *User) SetConfirmToken(token string)

func (*User) SetConfirmed

func (u *User) SetConfirmed(confirmed bool)

func (*User) SetCreatedAt

func (u *User) SetCreatedAt(at time.Time)

func (*User) SetEmail

func (u *User) SetEmail(email string)

func (*User) SetID

func (u *User) SetID(id int64)

func (*User) SetLastAttempt

func (u *User) SetLastAttempt(at time.Time)

func (*User) SetLastLogin

func (u *User) SetLastLogin(at time.Time)

func (*User) SetLockedUntil

func (u *User) SetLockedUntil(until time.Time)

func (*User) SetPassword

func (u *User) SetPassword(password string)

func (*User) SetRecoveryToken

func (u *User) SetRecoveryToken(token string)

func (*User) SetRoles

func (u *User) SetRoles(roles []string)

func (*User) SetTOTPSecret

func (u *User) SetTOTPSecret(secret string)

func (*User) SetUsername

func (u *User) SetUsername(username string)

type UserStorage

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

func NewUserStorage

func NewUserStorage(db *sql.DB) *UserStorage

func (*UserStorage) CreateOAuth2Identity

func (s *UserStorage) CreateOAuth2Identity(ctx context.Context, user papers.User, provider, identity string) error

func (*UserStorage) CreateUser

func (s *UserStorage) CreateUser(ctx context.Context, user papers.User) error

func (*UserStorage) GetUserByConfirmationToken

func (s *UserStorage) GetUserByConfirmationToken(ctx context.Context, token string) (papers.User, error)

func (*UserStorage) GetUserByEmail

func (s *UserStorage) GetUserByEmail(ctx context.Context, email string) (papers.User, error)

func (*UserStorage) GetUserByID

func (s *UserStorage) GetUserByID(ctx context.Context, id int64) (papers.User, error)

func (*UserStorage) GetUserByOAuth2Identity

func (s *UserStorage) GetUserByOAuth2Identity(ctx context.Context, provider, identity string) (papers.User, error)

func (*UserStorage) GetUserByRecoveryToken

func (s *UserStorage) GetUserByRecoveryToken(ctx context.Context, token string) (papers.User, error)

func (*UserStorage) GetUserByUsername

func (s *UserStorage) GetUserByUsername(ctx context.Context, username string) (papers.User, error)

func (*UserStorage) GetUserPermissions

func (s *UserStorage) GetUserPermissions(ctx context.Context, user papers.User) ([]string, error)

func (*UserStorage) GetUserRoles

func (s *UserStorage) GetUserRoles(ctx context.Context, user papers.User) ([]string, error)

func (*UserStorage) NewUser

func (s *UserStorage) NewUser() papers.User

func (*UserStorage) RemoveOAuth2Identity

func (s *UserStorage) RemoveOAuth2Identity(ctx context.Context, user papers.User, provider, identity string) error

func (*UserStorage) UpdateUser

func (s *UserStorage) UpdateUser(ctx context.Context, user papers.User) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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