middleware

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: Apache-2.0 Imports: 9 Imported by: 11

Documentation

Index

Constants

View Source
const ClaimsKey contextKey = "claims"

SessionContextKey is the context key for the Login Session

View Source
const HeadersKey contextKey = "headers"

Variables

View Source
var (
	ErrHeadersMissing = errors.New("tumbler headers missing in context")
	ErrClaimsMissing  = errors.New("tumbler claims missing in context")
)

Functions

func UseClient added in v0.2.0

func UseClient(client *http.Client) *http.Client

func WithClaimsFromRequest

func WithClaimsFromRequest(w http.ResponseWriter, r *http.Request, run func(TumblerClaims))

Types

type ServerMiddleware added in v0.2.0

type ServerMiddleware interface {
	Handler(h http.Handler) http.Handler
}

func NewServer added in v0.2.0

func NewServer(log logging.Logger, times stime.TimeService, jweService jwe.JWEService) (ServerMiddleware, error)

func NewServerFromConfig added in v0.2.0

func NewServerFromConfig(log logging.Logger, times stime.TimeService, config TumblerConfig) (ServerMiddleware, error)

type TumblerClaims

type TumblerClaims struct {
	jwe.Claims

	// These must match up with their json attribute names to the identity/pkg/session/Session json id names
	IdentityID     uuid.UUID  `json:"iid"`
	CredentialID   *uuid.UUID `json:"cid"`
	TenantID       uuid.UUID  `json:"tid"`
	OrganizationID *uuid.UUID `json:"oid"`
	// contains filtered or unexported fields
}

func ClaimsFromRequest

func ClaimsFromRequest(r *http.Request) (*TumblerClaims, error)

func (*TumblerClaims) ApplyToHeaders added in v0.2.0

func (c *TumblerClaims) ApplyToHeaders(headers *http.Header)

func (*TumblerClaims) LogContext

func (s *TumblerClaims) LogContext() map[string]string

func (*TumblerClaims) RequestContext added in v0.2.1

func (s *TumblerClaims) RequestContext() context.Context

type TumblerConfig

type TumblerConfig struct {
	Keys webkeys.WebKeysConfig
}

type TumblerHeaders added in v0.2.0

type TumblerHeaders struct {
	XRequestID      string
	XAuthToken      string
	XForwardedFor   string
	XForwardedProto string
	XForwardedHost  string
	Origin          string
	Referer         string
}

func TumblerHeadersFromHeaders added in v0.2.0

func TumblerHeadersFromHeaders(headers *http.Header) TumblerHeaders

func (*TumblerHeaders) ApplyToHeaders added in v0.2.0

func (h *TumblerHeaders) ApplyToHeaders(headers *http.Header)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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