auth

package
v0.41.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCESS_TOKEN  = "access-token"
	REFRESH_TOKEN = "refresh-token"
)

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(next http.Handler) http.Handler

func NewAccessToken

func NewAccessToken(claims UserClaims, secret string) (string, error)

func NewRefreshToken

func NewRefreshToken(claims jwt.StandardClaims, secret string) (string, error)

func ParseRefreshToken

func ParseRefreshToken(refreshToken string, secret string) *jwt.StandardClaims

func Router

func Router() chi.Router

Types

type RefreshToken

type RefreshToken string

type UserAuth

type UserAuth struct {
	User     string `json:"user_name"`
	PassHash string `json:"pass_hash"`
}

type UserClaims

type UserClaims struct {
	Nickname string `json:"nickname"`
	//User     models.User `json:"user"`
	jwt.StandardClaims
}

func ParseAccessToken

func ParseAccessToken(accessToken string, secret string) *UserClaims

Jump to

Keyboard shortcuts

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