auth

package
v0.0.0-...-ae6e605 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const UIDKey uidType = "uid"

Variables

This section is empty.

Functions

func Authenticator

func Authenticator(next http.Handler) http.Handler

Authenticator is middleware who sends a 401 response for requests with bad tokens and accepts requests with good tokens.

func CompareHashAndPassword

func CompareHashAndPassword(h, p string) error

CompareHashAndPassword compares a hash and a password returning an error when the hash an password do not match.

func GenerateFromPassword

func GenerateFromPassword(p string) (*string, error)

GenerateFromPassword returns a hashed version of the given string.

func GetTokenForUser

func GetTokenForUser(userID int) (jwt.Token, string, error)

GetTokenForUser returns a token with the given claims.

func Verifier

func Verifier(h http.Handler) http.Handler

Verifier is middleware for seeking, verifying and validating JWT tokens.

Types

This section is empty.

Jump to

Keyboard shortcuts

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