auth

package
v0.0.0-...-aa737f3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) (string, error)

func ValidatePassword

func ValidatePassword(password string) error

func ValidatePasswordCorrect

func ValidatePasswordCorrect(hashedPassword, submittedPassword string) error

Types

type AuthMiddleware

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

func NewAuthMiddleware

func NewAuthMiddleware(db Store, auth *AuthService) *AuthMiddleware

func (*AuthMiddleware) Admin

func (am *AuthMiddleware) Admin(next http.Handler) http.Handler

func (*AuthMiddleware) Private

func (am *AuthMiddleware) Private(next http.Handler) http.Handler

type AuthService

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

func NewAuthService

func NewAuthService(secretKey string) *AuthService

func (*AuthService) GenerateTokens

func (a *AuthService) GenerateTokens(uuid string) (*user.AuthTokens, error)

func (*AuthService) GetTokenAuth

func (a *AuthService) GetTokenAuth() *jwtauth.JWTAuth

func (*AuthService) ParseAccessToken

func (a *AuthService) ParseAccessToken(accessToken string) (*uuid.UUID, error)

func (*AuthService) ParseRefreshToken

func (a *AuthService) ParseRefreshToken(refreshToken string) (*uuid.UUID, error)

type Store

type Store interface {
	GetUserByUUID(ctx context.Context, uuid uuid.UUID) (*ent.User, error)
}

Jump to

Keyboard shortcuts

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