middleware

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleFactory_NewBackend

func ExampleFactory_NewBackend()

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

func ExampleFactory_NewClient

func ExampleFactory_NewClient()

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

func ExampleFactory_NewGateway

func ExampleFactory_NewGateway()

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

func ExampleFactory_NewStandalone

func ExampleFactory_NewStandalone()

ExampleFactory_NewStandalone 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