clalbauthn

package
v0.30.11 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package clalbauthn functionality for dealing with requests that passed trough AWS ALB authentication action.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessToken

func AccessToken(ctx context.Context) string

AccessToken returns the x-amzn-oidc-accesstoken value, or an empty string.

func ClaimData

func ClaimData(ctx context.Context) string

ClaimData returns the x-amzn-oidc-data value, or an empty string.

func Identity

func Identity(ctx context.Context) string

Identity returns the x-amzn-oidc-identity value, or an empty string.

func Provide

func Provide() fx.Option

Provide configures the DI for providng rpc.

func WithAccessToken

func WithAccessToken(ctx context.Context, token string) context.Context

WithAccessToken returns a context with the token value.

func WithClaimData

func WithClaimData(ctx context.Context, data string) context.Context

WithClaimData returns a context with the claim data value.

func WithIdentity

func WithIdentity(ctx context.Context, identity string) context.Context

WithIdentity returns a context with the identity value.

Types

type Authentication

type Authentication struct {
	// contains filtered or unexported fields
}

Authentication provides middleware that adds the AWS ALB authentication claims in the request context.

func New

func New(cfg Config, unauthf UnauthenticatedHandler) *Authentication

New inits the authentication middleware.

func (Authentication) Handler

func (a Authentication) Handler(next http.Handler) http.Handler

Handler returns the middleware.

type Config

type Config struct {
	// If this is set the middleware will NOT return a 401 if the request does not have all the authn headers.
	AllowUnauthenticated bool `env:"ALLOW_UNAUTHENTICATED"`
}

Config configures this package.

type UnauthenticatedHandler

type UnauthenticatedHandler func(w http.ResponseWriter, msg string, code int)

UnauthenticatedHandler provides a handler for when the request is unauthenticated.

Jump to

Keyboard shortcuts

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