auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package auth holds the authentication library

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrJWTMissingInvalid is returned when the JWT is missing or invalid
	ErrJWTMissingInvalid = errors.New("JWT token missing or invalid")

	// ErrJWTClaimsInvalid is returned when the token could not be cast to jwt.MapClaims
	ErrJWTClaimsInvalid = errors.New("JWT claims missing or invalid")

	// ErrSubjectNotFound is returned when the sub is not found in the JWT claims
	ErrSubjectNotFound = errors.New("JWT claims missing subject")
)

Functions

func CreateJwtMiddleware

func CreateJwtMiddleware(secret []byte) echo.MiddlewareFunc

CreateJwtMiddleware creates a middleware function for JWTs TODO expand the config settings

func GetActorSubject

func GetActorSubject(c echo.Context) (string, error)

GetActorSubject returns the user from the echo.Context

func GetUserIDFromContext

func GetUserIDFromContext(ctx context.Context) (string, error)

GetUserIDFromContext returns the actor subject from the echo context

func RegisterAuthFlags

func RegisterAuthFlags(v *viper.Viper, flags *pflag.FlagSet) error

RegisterAuthFlags registers the flags for the authentication configuration

Types

This section is empty.

Jump to

Keyboard shortcuts

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