handlers

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package handlers contains handlers for the JWT Mock server.

Index

Constants

View Source
const (
	// ClientsDefaultPath is the default path for ClientsHandler handlers.
	ClientsDefaultPath = "/jwtmock/clients"

	// ClientDefaultTokenPath is the path for authenticating clients
	// nolint:gosec // ignore irrelevant warning
	ClientDefaultTokenPath = "/oauth/token"
)
View Source
const JWKSDefaultPath = "/.well-known/jwks.json"

JWKSDefaultPath is the default path for JWKS handlers.

View Source
const JWTDefaultPath = "/jwtmock/generate-jwt"

JWTDefaultPath is the default path for JWT handlers.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(keyStore keyStore, clientRepo clientRepo, logger *log.Logger) http.Handler

NewHandler the fully-wired HTTP handler with all routes registered.

Types

type ClientsHandler added in v1.1.1

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

ClientsHandler provides handlers for working with API clients for machine-to-machine workflows.

func NewClientsHandler added in v1.1.1

func NewClientsHandler(keyStore keyStore, clientRepo clientRepo, logger *log.Logger) *ClientsHandler

NewClientsHandler is the preferred way to create a ClientsHandler instance.

func (*ClientsHandler) Register added in v1.1.1

func (h *ClientsHandler) Register(w http.ResponseWriter, r *http.Request)

Register register a client

func (*ClientsHandler) RegisterDefaultPaths added in v1.1.1

func (h *ClientsHandler) RegisterDefaultPaths(api *http.ServeMux)

RegisterDefaultPaths registers the default paths for JWKS operations.

func (*ClientsHandler) Token added in v1.1.1

func (h *ClientsHandler) Token(w http.ResponseWriter, r *http.Request)

Token authenticates a client and generates a token

type JWKSHandler

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

JWKSHandler provides handlers for JWKS operations and stores state of the current JWKS.

func NewJWKSHandler

func NewJWKSHandler(keyStore keyStore, logger *log.Logger) *JWKSHandler

NewJWKSHandler is the preferred way to create a JWKSHandler instance.

func (*JWKSHandler) Get

func (h *JWKSHandler) Get(w http.ResponseWriter, _ *http.Request)

Get returns a JSON web key set for the authorization server.

func (*JWKSHandler) Post

func (h *JWKSHandler) Post(w http.ResponseWriter, _ *http.Request)

Post forces a new JSON web key set to be created / the key set to be refreshed.

func (*JWKSHandler) RegisterDefaultPaths

func (h *JWKSHandler) RegisterDefaultPaths(api *http.ServeMux)

RegisterDefaultPaths registers the default paths for JWKS operations.

type JWTHandler

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

JWTHandler provides handlers for working with JWTs

func NewJWTHandler

func NewJWTHandler(keyStore keyStore, logger *log.Logger) *JWTHandler

NewJWTHandler is the preferred way to create a JWTHandler instance.

func (*JWTHandler) Post

func (h *JWTHandler) Post(w http.ResponseWriter, r *http.Request)

Post creates a signed JWT with the provided claims.

func (*JWTHandler) RegisterDefaultPaths

func (h *JWTHandler) RegisterDefaultPaths(api *http.ServeMux)

RegisterDefaultPaths registers the default paths for JWKS operations.

Jump to

Keyboard shortcuts

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