auth

package
v0.0.0-...-5ff450b Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPrincipal

func GetPrincipal(c *gin.Context) (jwt.User, bool)

GetPrincipal returns the authenticated user if exists.

func MustGetPrincipal

func MustGetPrincipal(c *gin.Context) (jwt.User, error)

MustGetPrincipal returns the authenticated user or an error if none exists.

Types

type RBAC

type RBAC struct {
	Verifier jwt.Verifier
}

RBAC adds role based access controll checks extracting roles from jwt.

func NewRBAC

func NewRBAC(creds jwt.Credentials) RBAC

NewRBAC creates a new RBAC struct with sane defaults.

func (*RBAC) Secure

func (r *RBAC) Secure(requiredScope scope.Scope) gin.HandlerFunc

Secure checks if a request was made with a jwt containing a specified list of roles.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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