shared

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 6 Imported by: 0

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