Documentation ¶
Index ¶
- Constants
- func AuthMiddleware(next http.Handler) http.Handler
- func NewAccessToken(claims UserClaims, secret string) (string, error)
- func NewRefreshToken(claims jwt.StandardClaims, secret string) (string, error)
- func ParseRefreshToken(refreshToken string, secret string) *jwt.StandardClaims
- func Router() chi.Router
- type AuthUser
- type UserClaims
Constants ¶
View Source
const ( ACCESS_TOKEN = "access-token" REFRESH_TOKEN = "refresh-token" )
Variables ¶
This section is empty.
Functions ¶
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
Types ¶
type AuthUser ¶ added in v0.43.7
type AuthUser struct { // Nickname is the user's very username. Nickname string `json:"nickname"` // Passphrase is a legacy format converted to string from a raw byte stream // (do not use anymore as this will be removed in future versions). Passphrase string `json:"passphrase"` // PassphraseHex is a hexadecimal representation of a passphrase (a SHA-512 checksum). // Use 'echo $PASS | sha512sum' for example to get the hex format. PassphraseHex string `json:"passphrase_hex"` }
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
Click to show internal directories.
Click to hide internal directories.