middleware

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaimsFromContext

func ClaimsFromContext(ctx context.Context) *oidc.Claims

ClaimsFromContext returns the claims for the given request context

func RawIDTokenFromContext

func RawIDTokenFromContext(ctx context.Context) string

RawIDTokenFromContext returns the raw JWT from the given request context

func TokenSourceFromContext

func TokenSourceFromContext(ctx context.Context) oidc.TokenSource

TokenSourceFromContext returns a usable tokensource from this request context. The request must have been wrapped with the middleware for this to be initialized. This token source is

Types

type Handler

type Handler struct {
	// Issuer is the URL to the OIDC issuer
	Issuer string
	// ClientID is a client ID for the relying party (the service authenticating
	// against the OIDC server)
	ClientID string
	// ClientSecret is a client secret for the relying party
	ClientSecret string
	// BaseURL is the base URL for this relying party. If it is not safe to
	// redirect the user to their original destination, they will be redirected
	// to this URL.
	BaseURL string
	// RedirectURL is the callback URL registered with the OIDC issuer for this
	// relying party
	RedirectURL string
	// AdditionalScopes is a list of scopes to request from the OIDC server, in
	// addition to the base oidc scope.
	AdditionalScopes []string
	// ACRValues to request from the remote server. The handler validates that
	// the returned token contains one of these.
	ACRValues []string

	// SessionStore is used to persist token information across requests. It
	// must support sufficient storage for the ID and any refresh tokens. This
	// must be provided.
	SessionStore sessions.Store
	// SessionName is a name used for the session. If empty, a default session
	// name is used.
	SessionName string
	// contains filtered or unexported fields
}

Handler wraps another http.Handler, protecting it with OIDC authentication.

func (*Handler) Wrap

func (h *Handler) Wrap(next http.Handler) http.Handler

Wrap returns an http.Handler that wraps the given http.Handler and provides OIDC authentication.

Jump to

Keyboard shortcuts

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