Documentation
¶
Index ¶
- Constants
- Variables
- func UrlJoin(base, path string) string
- type Client
- type ClientOptions
- type Consumer
- type HealthConsumer
- type HealthResponse
- type HealthRouter
- type OIDCRouter
- func (h *OIDCRouter) DecorateHandler(mux *http.ServeMux)
- func (h *OIDCRouter) HandleAuth(w http.ResponseWriter, r *http.Request)
- func (h *OIDCRouter) HandleDiscovery(w http.ResponseWriter, r *http.Request)
- func (h *OIDCRouter) HandleInfo(w http.ResponseWriter, r *http.Request)
- func (h *OIDCRouter) HandlePublicKeys(w http.ResponseWriter, r *http.Request)
- func (h *OIDCRouter) HandleToken(w http.ResponseWriter, r *http.Request)
- func (h *OIDCRouter) Handler() http.Handler
- type OIDCRouterOptions
- type Server
- type ServerOptions
Constants ¶
const ( DiscoEndpoint = "/.well-known/openid-configuration" KeysEndpoint = "/.well-known/jwks.json" AuthEndpoint = "/authorize" InfoEndpoint = "/userinfo" TokenEndpoint = "/token" )
const (
HealthEndpoint = "/health"
)
Variables ¶
var (
ErrInvalidData = errors.New("malformed health information received")
)
var UserAgent string = "Basic-Oauth2"
Functions ¶
Types ¶
type ClientOptions ¶
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 ServerOptions ¶
func (*ServerOptions) Server ¶
func (o *ServerOptions) Server() (*Server, error)