Skip to main content

authctx

import "github.com/Ask-Atlas/AskAtlas/api/pkg/authctx"

Package authctx provides context extractors and utilities for handling user authentication states.

Index

func UserIDFromContext

func UserIDFromContext(ctx context.Context) (uuid.UUID, bool)

UserIDFromContext retrieves the user ID from the given context, if present.

func WithUserID

func WithUserID(ctx context.Context, id uuid.UUID) context.Context

WithUserID injects the given user ID into the provided context.

type UserIDResolver

UserIDResolver defines an interface for fetching internal user IDs mapped from external Clerk IDs.

type UserIDResolver interface {
GetUserIDByClerkID(ctx context.Context, clerkID string) (uuid.UUID, error)
}

Generated by gomarkdoc