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 WithClaimsFromRequest ¶
func WithClaimsFromRequest(w http.ResponseWriter, r *http.Request, run func(TumblerClaims))
Types ¶
type ServerMiddleware ¶ added in v0.2.0
func NewServer ¶ added in v0.2.0
func NewServer(log logging.Logger, times stime.TimeService, keyService webkeys.WebKeysService, config TumblerConfig) (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 { jwt.Claims TenantID uuid.UUID `json:"tid,omitempty"` RemoteAddr string `json:"ip,omitempty"` AuthenticatedBy string `json:"atn,omitempty"` // These must match up with their json attribute names to the identity/pkg/session/Session json id names IdentityID *uuid.UUID `json:"iid,omitempty"` CredentialID *uuid.UUID `json:"cid,omitempty"` OrganizationID *uuid.UUID `json:"oid,omitempty"` CustomerID *uuid.UUID `json:"csid,omitempty"` APIKeyID *uuid.UUID `json:"aid,omitempty"` Scopes []string `json:"scp"` // 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)
Set and overwrite all the headers used by upstream services that don't inspect the token
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 { ServiceName string Keys webkeys.WebKeysConfig }
type TumblerHeaders ¶ added in v0.2.0
type TumblerHeaders struct { XRequestID string XAuthToken string XRealIp 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)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.