authz

package
v0.0.0-...-98d3fe0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 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 CustomClaims

type CustomClaims struct {
	PassportNumber string `json:"passport_number"`
	jwt.StandardClaims
}

type JWTAuthz

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

func NewJWTAuthz

func NewJWTAuthz(storage Storage, signingKey string, log Log) *JWTAuthz

func (*JWTAuthz) AuthCookie

func (j *JWTAuthz) AuthCookie(name string, token string) *http.Cookie

func (*JWTAuthz) CreateJWTTokenForUser

func (j *JWTAuthz) CreateJWTTokenForUser(userid string) string

func (*JWTAuthz) DecodeJWTToUser

func (j *JWTAuthz) DecodeJWTToUser(token string) (string, error)

func (*JWTAuthz) GetHash

func (j *JWTAuthz) GetHash(passportNumber string, password string) []byte

func (*JWTAuthz) JWTAuthzMiddleware

func (j *JWTAuthz) JWTAuthzMiddleware(log Log) func(next http.Handler) http.Handler

JWTAuthzMiddleware verifies a valid JWT exists in our cookie and if not, encourages the consumer to login again.

type Log

type Log interface {
	Info(string, ...zapcore.Field)
}

type Storage

type Storage interface {
	GetUser(context.Context, int, int) (models.User, error)
}

Jump to

Keyboard shortcuts

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