session

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(provider UserProvider) func(next echo.HandlerFunc) echo.HandlerFunc

Middleware is a echo MiddlewareFunc that extracts session data from incoming HTTP requests and handles automatic issuing of new access tokens for provided refresh tokens. trunk-ignore(golangci-lint/gocognit)

func Require

func Require() echo.MiddlewareFunc

Require aborts an incoming http request if it does not have a valid session token.

func UserFromCtx

func UserFromCtx(ctx context.Context) *idmv1.Profile

UserFromCtx returns the username associated with ctx. It returns an empty name in case no session is available.

Types

type UserProvider

type UserProvider interface {
	GetUser(ctx context.Context, userId string) (*idmv1.Profile, error)
}

UserProvider is used to retrieve the user by name.

type UserProviderFunc

type UserProviderFunc func(ctx context.Context, id string) (*idmv1.Profile, error)

UserProviderFunc is a convenience type for implementing UserProvider.

func (UserProviderFunc) GetUser

func (upf UserProviderFunc) GetUser(ctx context.Context, id string) (*idmv1.Profile, error)

GetUser implements UserProvider.

Jump to

Keyboard shortcuts

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