web

package
v0.0.0-...-ee3e022 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscoEndpoint = "/.well-known/openid-configuration"
	KeysEndpoint  = "/.well-known/jwks.json"
	AuthEndpoint  = "/authorize"
	InfoEndpoint  = "/userinfo"
	TokenEndpoint = "/token"
)
View Source
const (
	HealthEndpoint = "/health"
)

Variables

View Source
var (
	ErrInvalidData = errors.New("malformed health information received")
)
View Source
var UserAgent string = "Basic-Oauth2"

Functions

func UrlJoin

func UrlJoin(base, path string) string

Types

type Client

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

func (*Client) Network

func (c *Client) Network() string

func (*Client) String

func (c *Client) String() string

func (*Client) URI

func (c *Client) URI(path string) string

func (*Client) Visit

func (c *Client) Visit(path string, consumer Consumer) error

type ClientOptions

type ClientOptions struct {
	Socket  string
	Address string
	Port    int
}

func (*ClientOptions) Client

func (o *ClientOptions) Client() (*Client, error)

type Consumer

type Consumer interface {
	UnmarshalSample() interface{}
	Consume(interface{}) error
}

type HealthConsumer

type HealthConsumer []string

HealthConsumer is a response consumer implementation expecting API health information (HealthResponse) as input.

func NewAPIHealthConsumer

func NewAPIHealthConsumer() HealthConsumer

NewAPIHealthConsumer creates a health consumer instance based on the IETF Draft for Health Check Response Format for HTTP APIs. (https://inadarei.github.io/rfc-healthcheck/)

func NewHealthConsumer

func NewHealthConsumer(okStatus ...string) HealthConsumer

func (HealthConsumer) Consume

func (c HealthConsumer) Consume(data interface{}) error

func (HealthConsumer) UnmarshalSample

func (c HealthConsumer) UnmarshalSample() interface{}

type HealthResponse

type HealthResponse struct {
	Status      string                   `json:"status,omitempty"`
	Output      string                   `json:"output,omitempty"`
	Version     string                   `json:"version,omitempty"`
	ReleaseId   string                   `json:"releaseId,omitempty"`
	ServiceId   string                   `json:"serviceId,omitempty"`
	Description string                   `json:"description,omitempty"`
	Notes       []string                 `json:"notes,omitempty"`
	Checks      map[string][]interface{} `json:"checks,omitempty"`
	Links       map[string]string        `json:"links,omitempty"`
}

API response structure as defined by the IETF Draft for Health Check Response Format for HTTP APIs (https://inadarei.github.io/rfc-healthcheck/)

type HealthRouter

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

func NewHealthRouter

func NewHealthRouter(logger *log.Controller) *HealthRouter

func (*HealthRouter) DecorateHandler

func (r *HealthRouter) DecorateHandler(mux *http.ServeMux)

func (*HealthRouter) HandleHealth

func (r *HealthRouter) HandleHealth(w http.ResponseWriter, _ *http.Request)

HandleHealth returns the system health information.

func (*HealthRouter) Handler

func (r *HealthRouter) Handler() http.Handler

type OIDCRouter

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

func (*OIDCRouter) DecorateHandler

func (h *OIDCRouter) DecorateHandler(mux *http.ServeMux)

func (*OIDCRouter) HandleAuth

func (h *OIDCRouter) HandleAuth(w http.ResponseWriter, r *http.Request)

func (*OIDCRouter) HandleDiscovery

func (h *OIDCRouter) HandleDiscovery(w http.ResponseWriter, r *http.Request)

handleDiscovery returns the OpenID Connect discovery object, allowing clients to discover OAuth2 resources.

func (*OIDCRouter) HandleInfo

func (h *OIDCRouter) HandleInfo(w http.ResponseWriter, r *http.Request)

func (*OIDCRouter) HandlePublicKeys

func (h *OIDCRouter) HandlePublicKeys(w http.ResponseWriter, r *http.Request)

handlePublicKeys publishes the public part of this server's signing keys. This allows clients to verify the signature of ID Tokens.

func (*OIDCRouter) HandleToken

func (h *OIDCRouter) HandleToken(w http.ResponseWriter, r *http.Request)

func (*OIDCRouter) Handler

func (h *OIDCRouter) Handler() http.Handler

type OIDCRouterOptions

type OIDCRouterOptions struct {
	PubKeys []jose.JSONWebKey
	Signer  jose.Signer
	Server  *osin.Server

	Logger *log.Controller

	Login principal.Authenticator

	IssuerUrl    string
	AuthBaseUrl  string
	InfoBaseUrl  string
	TokenBaseUrl string
	KeysBaseUrl  string
}

func NewOIDCRouterOptions

func NewOIDCRouterOptions(server *osin.Server, signer jose.Signer, publicKeys ...jose.JSONWebKey) *OIDCRouterOptions

func (*OIDCRouterOptions) AccessTypes

func (o *OIDCRouterOptions) AccessTypes() []string

func (*OIDCRouterOptions) AuthorizeTypes

func (o *OIDCRouterOptions) AuthorizeTypes() []string

func (*OIDCRouterOptions) DiscoveryData

func (o *OIDCRouterOptions) DiscoveryData() map[string]interface{}

func (*OIDCRouterOptions) Router

func (o *OIDCRouterOptions) Router() (*OIDCRouter, error)

func (*OIDCRouterOptions) SigningAlgorithms

func (o *OIDCRouterOptions) SigningAlgorithms() []string

type Server

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

func (*Server) Network

func (s *Server) Network() string

func (*Server) Run

func (s *Server) Run(handler http.Handler) error

func (*Server) String

func (s *Server) String() string

type ServerOptions

type ServerOptions struct {
	Socket  string
	Address string
	Port    int
}

func (*ServerOptions) Server

func (o *ServerOptions) Server() (*Server, error)

Jump to

Keyboard shortcuts

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