shared

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOAuthServerClient

func GetOAuthServerClient(ctx context.Context) *models.OAuthServerClient

GetOAuthServerClient retrieves an OAuth server client from the context

func GetSession

func GetSession(ctx context.Context) *models.Session

GetSession reads the session from the context - shared implementation

func GetUser

func GetUser(ctx context.Context) *models.User

GetUser reads the user from the context - shared implementation

func SendJSON

func SendJSON(w http.ResponseWriter, status int, obj interface{}) error

SendJSON sends a JSON response with proper error handling

func WithOAuthServerClient

func WithOAuthServerClient(ctx context.Context, client *models.OAuthServerClient) context.Context

WithOAuthServerClient adds an OAuth server client to the context

func WithSession

func WithSession(ctx context.Context, s *models.Session) context.Context

WithSession adds the session to the context - shared implementation

func WithUser

func WithUser(ctx context.Context, u *models.User) context.Context

WithUser adds the user to the context - shared implementation

Types

type ContextKey

type ContextKey string

ContextKey is the type for context keys to avoid collisions

const (
	UserKey              ContextKey = "user"
	SessionKey           ContextKey = "session"
	OAuthServerClientKey ContextKey = "oauth_server_client"
)

Context keys used across packages

func (ContextKey) String

func (c ContextKey) String() string

Jump to

Keyboard shortcuts

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