auth

package
v0.0.0-...-a644e2b Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCredentials

func CheckCredentials() func(username, password string) (db.User, string, error)

Helper to generate a refresh JWT token on login

func CheckToken

func CheckToken(restrictedTo db.UserType) func(c *fiber.Ctx) error

Middleware that checks if the user is authenticated and authorized under under given restriction

func GetClaimsFromAccessToken

func GetClaimsFromAccessToken(bearerStr string) (jwt.MapClaims, error)

expects a bearer string with a jwt token signed by our jwt access key if successful the claims of said token are returned

func HashPW

func HashPW(password string) (string, error)

Helper to generate the hashed password on user creation

func InitAuth

func InitAuth() error

func RefreshAccessToken

func RefreshAccessToken(token string) (string, error)

takes a refresh token as parameter and returns a new access token

Types

type Auth

type Auth struct {
	JWTAccessKeypair  *rsa.PrivateKey
	JWTRefreshKeypair *rsa.PrivateKey
}

Jump to

Keyboard shortcuts

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