auth

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextGet

func ContextGet[T any](ctx context.Context, key string) (T, bool)

func ContextSet

func ContextSet(ctx context.Context, key string, value any) context.Context

func IsLoggedIn

func IsLoggedIn(ctx context.Context) bool

func Load

func Load(userGetter UserGetter, intGetter GetInter) func(http.Handler) http.Handler

func LoadAuthToken

func LoadAuthToken(next http.Handler) http.Handler

func Require

func Require(next http.Handler) http.Handler

func UserFromContext

func UserFromContext(ctx context.Context) (*model.User, error)

Types

type GetInter

type GetInter interface {
	GetInt(ctx context.Context, key string) int
}

type UserGetter

type UserGetter interface {
	GetUserByID(context.Context, int) (*model.User, errs.Error)
}

Jump to

Keyboard shortcuts

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