middleware

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = hplugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "SYFON_AUTHZ_PLUGIN",
	MagicCookieValue: "syfon_authz_plugin_v1",
}

Plugin handshake config for go-plugin

Functions

This section is empty.

Types

type AuthenticationPluginManager added in v0.2.4

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

AuthenticationPluginManager manages the plugin process and calls Authenticate.

func NewAuthenticationPluginManager added in v0.2.4

func NewAuthenticationPluginManager(pluginPath string) (*AuthenticationPluginManager, error)

NewAuthenticationPluginManager loads the plugin binary and returns a manager.

func (*AuthenticationPluginManager) Authenticate added in v0.2.4

Authenticate delegates to the plugin.

type AuthnPluginRPC added in v0.2.4

type AuthnPluginRPC struct{ hplugin.Plugin }

AuthnPluginRPC is the hplugin.Plugin implementation for go-plugin.

func (*AuthnPluginRPC) Client added in v0.2.4

func (p *AuthnPluginRPC) Client(b *hplugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*AuthnPluginRPC) Server added in v0.2.4

func (p *AuthnPluginRPC) Server(*hplugin.MuxBroker) (interface{}, error)

type AuthnRPC added in v0.2.4

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

AuthnRPC implements AuthenticationPlugin over RPC.

func (*AuthnRPC) Authenticate added in v0.2.4

type AuthzMiddleware

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

func NewAuthzMiddleware

func NewAuthzMiddleware(logger *slog.Logger, mode, basicUser, basicPass string) *AuthzMiddleware

func (*AuthzMiddleware) FiberMiddleware added in v0.2.0

func (m *AuthzMiddleware) FiberMiddleware() fiber.Handler

FiberMiddleware returns a fiber middleware that extracts the token and fetches user info.

type AuthzPluginRPC added in v0.2.4

type AuthzPluginRPC struct{ hplugin.Plugin }

AuthzPluginRPC is the hplugin.Plugin implementation for go-plugin.

func (*AuthzPluginRPC) Client added in v0.2.4

func (p *AuthzPluginRPC) Client(b *hplugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*AuthzPluginRPC) Server added in v0.2.4

func (p *AuthzPluginRPC) Server(*hplugin.MuxBroker) (interface{}, error)

type AuthzRPC added in v0.2.4

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

AuthzRPC implements AuthorizationPlugin over RPC.

func (*AuthzRPC) Authorize added in v0.2.4

type DummyPluginManager added in v0.2.4

type DummyPluginManager struct{}

DummyPluginManager implements the same interface as PluginManager for testing.

func (*DummyPluginManager) Authorize added in v0.2.4

type Gen3AuthPlugin added in v0.2.4

type Gen3AuthPlugin struct {
	MockConfig mockAuthConfig
	Logger     any // Replace with actual logger type if needed
}

Gen3AuthPlugin implements AuthenticationPlugin for gen3 mode.

func (*Gen3AuthPlugin) Authenticate added in v0.2.4

type JWK added in v0.2.4

type JWK struct {
	Kty string `json:"kty"` // Key type (RSA, EC, etc)
	Use string `json:"use"` // Use (sig, enc)
	Kid string `json:"kid"` // Key ID
	N   string `json:"n"`   // RSA modulus
	E   string `json:"e"`   // RSA exponent
}

JWK represents a JSON Web Key

type JWKS added in v0.2.4

type JWKS struct {
	Keys []JWK `json:"keys"`
}

JWKS represents a JSON Web Key Set response

type JWKSCache added in v0.2.4

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

JWKSCache holds JWKS public keys for JWT signature verification

func NewJWKSCache added in v0.2.4

func NewJWKSCache(jwksURL string, ttl time.Duration) *JWKSCache

NewJWKSCache creates a new JWKS cache for the given endpoint

func (*JWKSCache) FetchKeys added in v0.2.4

func (c *JWKSCache) FetchKeys() error

FetchKeys retrieves and caches JWKS keys

func (*JWKSCache) GetKey added in v0.2.4

func (c *JWKSCache) GetKey(kid string) (interface{}, error)

GetKey retrieves a key by KID

type LocalAuthPlugin added in v0.2.4

type LocalAuthPlugin struct {
	BasicUser string
	BasicPass string
}

LocalAuthPlugin implements AuthenticationPlugin for local mode.

func (*LocalAuthPlugin) Authenticate added in v0.2.4

type PluginClient added in v0.2.4

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

PluginClient is the concrete implementation for plugin communication.

type PluginManager added in v0.2.4

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

PluginManager manages the plugin process and calls Authorize.

func NewPluginManager added in v0.2.4

func NewPluginManager(pluginPath string) (*PluginManager, error)

NewPluginManager loads the plugin binary and returns a manager.

func (*PluginManager) Authorize added in v0.2.4

Authorize delegates to the plugin.

type RequestIDMiddleware

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

func NewRequestIDMiddleware

func NewRequestIDMiddleware(logger *slog.Logger) *RequestIDMiddleware

func (*RequestIDMiddleware) FiberMiddleware added in v0.2.0

func (m *RequestIDMiddleware) FiberMiddleware() fiber.Handler

Jump to

Keyboard shortcuts

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