middleware

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleFactoryNewBackend added in v1.3.0

func ExampleFactoryNewBackend()

ExampleFactoryNewBackend demonstrates how to set up a backend server. A backend server expects a principal in the context and performs authorization.

func ExampleFactoryNewClient added in v1.3.0

func ExampleFactoryNewClient()

ExampleFactoryNewClient demonstrates how to set up a client to propagate credentials.

func ExampleFactoryNewGateway added in v1.3.0

func ExampleFactoryNewGateway()

ExampleFactoryNewGateway demonstrates how to set up a gateway server. A gateway authenticates requests and then relies on the transport to propagate the principal.

func ExampleFactoryNewStandalone added in v1.3.0

func ExampleFactoryNewStandalone()

ExampleFactoryNewStandalone demonstrates how to set up a service that handles both authentication and authorization.

Types

type Factory

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

Factory creates a consistent set of security middleware. It ensures that all created client and server middleware use the same principal propagation type.

func NewFactory

func NewFactory(propType ...principal.PropagationType) *Factory

NewFactory creates a new middleware factory. It accepts an optional PropagationType. If omitted, it defaults to PropagationTypeKratos.

func (*Factory) NewBackend

func (f *Factory) NewBackend(authorizer authz.Authorizer, skipChecker security.SkipChecker) middleware.KMiddleware

NewBackend creates a server-side middleware for backend services. It expects a principal to be propagated in the context (using the factory's propagation type) and performs authorization based on it.

func (*Factory) NewClient

func (f *Factory) NewClient() middleware.KMiddleware

NewClient creates the client-side security middleware. It uses the factory's propagation type to propagate the principal from the context to the outgoing request.

func (*Factory) NewGateway

func (f *Factory) NewGateway(authenticator authn.Authenticator, skipChecker security.SkipChecker) middleware.KMiddleware

NewGateway creates a server-side middleware for services that act as a gateway. It performs authentication and then propagates the resulting principal. It does not perform authorization.

func (*Factory) NewStandalone

func (f *Factory) NewStandalone(authenticator authn.Authenticator, authorizer authz.Authorizer, authnSkip security.SkipChecker, authzSkip security.SkipChecker) middleware.KMiddleware

NewStandalone creates a server-side middleware for services that perform both authentication and authorization.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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