plugins

package
v1.4.13-alpha1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const BrambleRequestHeader = "X-Request-Id"

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminUIPlugin

type AdminUIPlugin struct {
	bramble.BasePlugin
	// contains filtered or unexported fields
}

AdminUIPlugin serves a minimal administration interface.

func (*AdminUIPlugin) ID

func (p *AdminUIPlugin) ID() string

func (*AdminUIPlugin) Init

func (*AdminUIPlugin) SetupPrivateMux

func (p *AdminUIPlugin) SetupPrivateMux(mux *http.ServeMux)

type Claims

type Claims struct {
	jwt.StandardClaims
	Role string
}

type CorsPlugin

type CorsPlugin struct {
	bramble.BasePlugin
	// contains filtered or unexported fields
}

func NewCorsPlugin

func NewCorsPlugin(options CorsPluginConfig) *CorsPlugin

func (*CorsPlugin) ApplyMiddlewarePrivateMux

func (p *CorsPlugin) ApplyMiddlewarePrivateMux(h http.Handler) http.Handler

func (*CorsPlugin) ApplyMiddlewarePublicMux

func (p *CorsPlugin) ApplyMiddlewarePublicMux(h http.Handler) http.Handler

func (*CorsPlugin) Configure

func (p *CorsPlugin) Configure(cfg *bramble.Config, data json.RawMessage) error

func (*CorsPlugin) ID

func (p *CorsPlugin) ID() string

type CorsPluginConfig

type CorsPluginConfig struct {
	AllowedOrigins   []string `json:"allowed-origins"`
	AllowedHeaders   []string `json:"allowed-headers"`
	AllowCredentials bool     `json:"allow-credentials"`
	MaxAge           int      `json:"max-age"`
	Debug            bool     `json:"debug"`
}

type HeadersPlugin

type HeadersPlugin struct {
	bramble.BasePlugin
	// contains filtered or unexported fields
}

func NewHeadersPlugin

func NewHeadersPlugin(options HeadersPluginConfig) *HeadersPlugin

func (*HeadersPlugin) ApplyMiddlewarePrivateMux

func (p *HeadersPlugin) ApplyMiddlewarePrivateMux(h http.Handler) http.Handler

func (*HeadersPlugin) ApplyMiddlewarePublicMux

func (p *HeadersPlugin) ApplyMiddlewarePublicMux(h http.Handler) http.Handler

func (*HeadersPlugin) Configure

func (p *HeadersPlugin) Configure(cfg *bramble.Config, data json.RawMessage) error

func (*HeadersPlugin) ID

func (p *HeadersPlugin) ID() string

type HeadersPluginConfig

type HeadersPluginConfig struct {
	AllowedHeaders []string `json:"allowed-headers"`
}

type JWTPlugin

type JWTPlugin struct {
	bramble.BasePlugin
	// contains filtered or unexported fields
}

JWTPlugin validates that requests contains a valid JWT access token and add the necessary permissions and information to the context

func NewJWTPlugin

func NewJWTPlugin(
	keyProviders []SigningKeyProvider,
	roles map[string]bramble.OperationPermissions,
) *JWTPlugin

func (*JWTPlugin) ApplyMiddlewarePublicMux

func (p *JWTPlugin) ApplyMiddlewarePublicMux(h http.Handler) http.Handler

func (*JWTPlugin) Configure

func (p *JWTPlugin) Configure(cfg *bramble.Config, data json.RawMessage) error

func (*JWTPlugin) ID

func (p *JWTPlugin) ID() string

type JWTPluginConfig

type JWTPluginConfig struct {
	// List of JWKS endpoints
	JWKS []WellKnownKeyProvider `json:"jwks"`
	// Map of kid -> public key (RSA, PEM format)
	PublicKeys map[string]string                       `json:"public-keys"`
	Roles      map[string]bramble.OperationPermissions `json:"roles"`
}

type LimitsPlugin

type LimitsPlugin struct {
	bramble.BasePlugin
	// contains filtered or unexported fields
}

func NewLimitsPlugin

func NewLimitsPlugin(options LimitsPluginConfig) *LimitsPlugin

func (*LimitsPlugin) ApplyMiddlewarePublicMux

func (p *LimitsPlugin) ApplyMiddlewarePublicMux(h http.Handler) http.Handler

func (*LimitsPlugin) Configure

func (p *LimitsPlugin) Configure(cfg *bramble.Config, data json.RawMessage) error

func (*LimitsPlugin) ID

func (p *LimitsPlugin) ID() string

func (*LimitsPlugin) Init

func (p *LimitsPlugin) Init(es *bramble.ExecutableSchema)

type LimitsPluginConfig

type LimitsPluginConfig struct {
	MaxRequestBytes int64  `json:"max-request-bytes"`
	MaxResponseTime string `json:"max-response-time"`
	// contains filtered or unexported fields
}

type ManualSigningKeysProvider

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

func NewManualSigningKeysProvider

func NewManualSigningKeysProvider(keys map[string]string) (*ManualSigningKeysProvider, error)

func (*ManualSigningKeysProvider) Keys

func (*ManualSigningKeysProvider) Name

type MetaPlugin

type MetaPlugin struct {
	*bramble.BasePlugin
	// contains filtered or unexported fields
}

func NewMetaPlugin

func NewMetaPlugin() *MetaPlugin

func (*MetaPlugin) GraphqlQueryPath

func (p *MetaPlugin) GraphqlQueryPath() (bool, string)

func (*MetaPlugin) ID

func (p *MetaPlugin) ID() string

func (*MetaPlugin) Init

func (p *MetaPlugin) Init(s *bramble.ExecutableSchema)

func (*MetaPlugin) SetupPrivateMux

func (p *MetaPlugin) SetupPrivateMux(mux *http.ServeMux)

type PlaygroundPlugin

type PlaygroundPlugin struct {
	*bramble.BasePlugin
}

func (*PlaygroundPlugin) ID

func (p *PlaygroundPlugin) ID() string

func (*PlaygroundPlugin) SetupPublicMux

func (p *PlaygroundPlugin) SetupPublicMux(mux *http.ServeMux)

type RequestIdentifierPlugin

type RequestIdentifierPlugin struct {
	bramble.BasePlugin
}

func (*RequestIdentifierPlugin) ApplyMiddlewarePrivateMux

func (p *RequestIdentifierPlugin) ApplyMiddlewarePrivateMux(h http.Handler) http.Handler

func (*RequestIdentifierPlugin) ApplyMiddlewarePublicMux

func (p *RequestIdentifierPlugin) ApplyMiddlewarePublicMux(h http.Handler) http.Handler

func (*RequestIdentifierPlugin) ID

type SigningKeyProvider

type SigningKeyProvider interface {
	Name() string
	Keys() (map[string]*rsa.PublicKey, error)
}

type WellKnownKeyProvider

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

func NewWellKnownKeyProvider

func NewWellKnownKeyProvider(url string) *WellKnownKeyProvider

func (*WellKnownKeyProvider) Keys

func (w *WellKnownKeyProvider) Keys() (map[string]*rsa.PublicKey, error)

func (*WellKnownKeyProvider) MarshalJSON

func (w *WellKnownKeyProvider) MarshalJSON() ([]byte, error)

func (*WellKnownKeyProvider) Name

func (w *WellKnownKeyProvider) Name() string

func (*WellKnownKeyProvider) UnmarshalJSON

func (w *WellKnownKeyProvider) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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