ubwww

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthTokenCookie

type AuthTokenCookie interface {
	IsExpired() bool
	Touch(unixSec int64)
}

type AuthTokenCookieManager

type AuthTokenCookieManager[T AuthTokenCookie] interface {
	ClearAuthTokenCookie(w http.ResponseWriter)
	ReadAuthTokenCookie(r *http.Request) (bool, T, error)
	WriteAuthTokenCookie(w http.ResponseWriter, token T) error
	Middleware(handler http.Handler) http.Handler
	MiddlewareFunc(handler http.HandlerFunc) http.HandlerFunc
	FromContext(ctx context.Context) (T, bool)
}

func NewCookieMonster

func NewCookieMonster[T AuthTokenCookie](
	encryptionService ubsecurity.EncryptionService,
	cookieName string,
	secure bool,
	tokenSoftExpiry int64,
	cookieKey CookieContextKey) AuthTokenCookieManager[T]

type CookieContextKey

type CookieContextKey string

type CookieMonster

type CookieMonster[T AuthTokenCookie] struct {
	// contains filtered or unexported fields
}

func (*CookieMonster[T]) ClearAuthTokenCookie

func (c *CookieMonster[T]) ClearAuthTokenCookie(w http.ResponseWriter)

func (*CookieMonster[T]) FromContext

func (c *CookieMonster[T]) FromContext(ctx context.Context) (T, bool)

func (*CookieMonster[T]) Middleware

func (c *CookieMonster[T]) Middleware(handler http.Handler) http.Handler

func (*CookieMonster[T]) MiddlewareFunc

func (c *CookieMonster[T]) MiddlewareFunc(handler http.HandlerFunc) http.HandlerFunc

func (*CookieMonster[T]) ReadAuthTokenCookie

func (c *CookieMonster[T]) ReadAuthTokenCookie(r *http.Request) (bool, T, error)

func (*CookieMonster[T]) WriteAuthTokenCookie

func (c *CookieMonster[T]) WriteAuthTokenCookie(w http.ResponseWriter, token T) error

Jump to

Keyboard shortcuts

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