Documentation
¶
Index ¶
- func ExampleFactory_NewBackend()
- func ExampleFactory_NewClient()
- func ExampleFactory_NewGateway()
- func ExampleFactory_NewStandalone()
- type Factory
- func (f *Factory) NewBackend(authorizer authz.Authorizer, skipChecker security.SkipChecker) middleware.KMiddleware
- func (f *Factory) NewClient() middleware.KMiddleware
- func (f *Factory) NewGateway(authenticator authn.Authenticator, skipChecker security.SkipChecker) middleware.KMiddleware
- func (f *Factory) NewStandalone(authenticator authn.Authenticator, authorizer authz.Authorizer, ...) middleware.KMiddleware
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.