auth

package
v0.0.0-...-4877560 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepository

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

func NewRepository

func NewRepository(
	logger *zerolog.Logger,
	usersCol,
	tokensCol,
	refTokensCol,
	resetPwdCol *mongo.Collection) *AuthRepository

func (*AuthRepository) AddResetPasswordRequest

func (repo *AuthRepository) AddResetPasswordRequest(ctx context.Context, emailaddress string, expiresAt time.Time) (*entities.ResetPwdReq, error)

func (*AuthRepository) ChangePassword

func (repo *AuthRepository) ChangePassword(ctx context.Context, userID string, newPwd []byte) error

func (*AuthRepository) DeleteJWT

func (repo *AuthRepository) DeleteJWT(
	ctx context.Context,
	ut *entities.UserToken) (int64, error)

func (*AuthRepository) DeleteRefreshToken

func (repo *AuthRepository) DeleteRefreshToken(
	ctx context.Context,
	userID string) (n int64, err error)

func (*AuthRepository) DeleteRefreshTokenAndAllTokens

func (repo *AuthRepository) DeleteRefreshTokenAndAllTokens(
	ctx context.Context,
	userID string) (n int64, err error)

func (*AuthRepository) GetRefreshToken

func (repo *AuthRepository) GetRefreshToken(
	ctx context.Context,
	userID string) (*entities.RefreshToken, error)

func (*AuthRepository) GetUserByEmailAddress

func (repo *AuthRepository) GetUserByEmailAddress(
	ctx context.Context,
	emailAddress string) (*entities.AuthUser, error)

func (*AuthRepository) GetUserByID

func (repo *AuthRepository) GetUserByID(ctx context.Context, id string) (*entities.AuthUser, error)

func (*AuthRepository) GetUserJWTs

func (repo *AuthRepository) GetUserJWTs(
	ctx context.Context,

	userID string,
	expired entities.ExpireType,
) ([]entities.UserToken, error)

func (*AuthRepository) SaveJWT

func (repo *AuthRepository) SaveJWT(
	ctx context.Context,
	userID string,
	device string,
	token string,
	expiresAt time.Time) (*entities.UserToken, error)

func (*AuthRepository) SaveRefreshToken

func (repo *AuthRepository) SaveRefreshToken(
	ctx context.Context,
	userID string,
	token string,
	expiresAt time.Time) (*entities.RefreshToken, error)

func (*AuthRepository) UpdatePasswordForResetRequest

func (repo *AuthRepository) UpdatePasswordForResetRequest(ctx context.Context, reqID string, pwdHash []byte) error

Jump to

Keyboard shortcuts

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