introspector

package module
v0.0.0-...-efe68d8 Latest Latest
Warning

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

Go to latest
Published: May 25, 2017 License: GPL-3.0 Imports: 11 Imported by: 5

README

introspector

Go kit middleware to introspect OAuth2 tokens with Hydra

Sample usage:

r.Methods("GET").Path("/classes/{class}").Handler(httptransport.NewServer(
		introspector.New(client.Introspection, "classes.get")(e.GetClassEndpoint),
		decodeGetClassRequest,
		encodeResponse,
		append(options, httptransport.ServerBefore(introspector.ToHTTPContext()))...
))

Documentation

Index

Constants

View Source
const (
	// OAuth2TokenContextKey holds the key used to store an OAuth2 Token in the context.
	OAuth2IntrospectionContextKey contextKey = "OAuth2Introspection"
	SubjectContextKey             contextKey = "Subject"
	TokenContextKey               contextKey = "Token"
)

Variables

This section is empty.

Functions

func FromGRPCContext

func FromGRPCContext() grpc.ClientRequestFunc

FromGRPCContext moves OAuth2 token from context to gRPC metadata. Particularly useful for clients.

func FromHTTPContext

func FromHTTPContext() http.RequestFunc

FromHTTPContext moves OAuth2 token from context to request header. Particularly useful for clients.

func New

func New(introspector hoauth2.Introspector, scopes ...string) endpoint.Middleware

func ToGRPCContext

func ToGRPCContext() grpc.ServerRequestFunc

ToGRPCContext moves OAuth2 token from gRPC metadata to context. Particularly useful for servers.

func ToHTTPContext

func ToHTTPContext() http.RequestFunc

ToHTTPContext moves OAuth2 token from request header to context. Particularly useful for servers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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