authorization

package
v0.2.53-rc5 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientCertFromContext

func ClientCertFromContext(ctx context.Context) (string, error)

func ExtractClientCert

func ExtractClientCert(ctx context.Context, header http.Header) (context.Context, error)

ExtractClientCert is called from the API to either propagate an existing certificate to the context, or to extract one from headers injected by TLS termination.

func InjectClientCert

func InjectClientCert(ctx context.Context, header http.Header)

InjectClientCert is called by clients to propagate the client certificate that started the call chain, and thus owns the access token, to the next server.

func NewContext added in v0.2.52

func NewContext(ctx context.Context, info *Info) context.Context

func NewContextWithClientCert

func NewContextWithClientCert(ctx context.Context, clientCert string) context.Context

NewContextWithClientCert is used to propagate the client certificate to other clients. The client certificate parameter is passed verbatim from the TLS termination header, so should be a url encoded string.

Types

type Info added in v0.2.52

type Info struct {
	// Token is a copy of the access token made available to handlers.
	Token string
	// Userinfo is a parsed version of the token, used primarily for
	// auditing etc.
	Userinfo *openapi.Userinfo
	// ClientID optionally records the oauth2 client that initiated
	// the session, and can be used to route errors to the correct
	// endpoint.
	ClientID string
	// ServiceAccount means this belongs explicitly to a service account.
	ServiceAccount bool
}

Info contains all the information we can derive from an access token.

func FromContext added in v0.2.52

func FromContext(ctx context.Context) (*Info, error)

Jump to

Keyboard shortcuts

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