authctx

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package authctx defines context keys and accessor functions for credentials stored in a request context by authentication middleware.

This package is a domain-level leaf: it imports no auth sub-packages, so any package in the auth module can import it without creating import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatedCustomClaimsFromContext

func AuthenticatedCustomClaimsFromContext(ctx context.Context) (map[string]any, bool)

AuthenticatedCustomClaimsFromContext extracts the authenticated claims from context.

func AuthenticatedPrincipalFromContext

func AuthenticatedPrincipalFromContext(ctx context.Context) (string, bool)

AuthenticatedPrincipalFromContext extracts the authenticated principal from context.

func AuthenticatedRegisteredClaimsFromContext

func AuthenticatedRegisteredClaimsFromContext(ctx context.Context) (jwtvalidator.RegisteredClaims, bool)

AuthenticatedRegisteredClaimsFromContext extracts the authenticated claims from context.

func ContextWithAuthenticatedCustomClaims

func ContextWithAuthenticatedCustomClaims(ctx context.Context, claims map[string]any) context.Context

ContextWithAuthenticatedCustomClaims stores the authenticated claims on the context.

func ContextWithAuthenticatedPrincipal

func ContextWithAuthenticatedPrincipal(ctx context.Context, principal string) context.Context

ContextWithAuthenticatedPrincipal stores the authenticated principal on the context.

func ContextWithAuthenticatedRegisteredClaims

func ContextWithAuthenticatedRegisteredClaims(ctx context.Context, claims jwtvalidator.RegisteredClaims) context.Context

ContextWithAuthenticatedRegisteredClaims stores the authenticated claims on the context.

func NewContextWithGitHubUserInfo

func NewContextWithGitHubUserInfo(ctx context.Context, userInfo *GitHubUserInfo) context.Context

NewContextWithGitHubUserInfo returns a new context with the provided GitHub user info.

Types

type GitHubUserInfo

type GitHubUserInfo struct {
	Login                string
	Name                 string
	PrimaryEmail         string
	PrimaryEmailVerified bool
	Company              string
	WebSite              string
	Location             string
	PlanName             string
}

GitHubUserInfo contains information about a GitHub user.

func GitHubUserInfoFromContext

func GitHubUserInfoFromContext(ctx context.Context) *GitHubUserInfo

GitHubUserInfoFromContext returns the GitHub user info from the provided context. It returns nil if no user info is found.

Jump to

Keyboard shortcuts

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