authz

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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MiddlewareName = "authz"
)

Variables

This section is empty.

Functions

func NoOpSkipChecker

func NoOpSkipChecker() security.SkipChecker

NoOpSkipChecker creates a SkipChecker that never skips authorization.

func PathSkipChecker

func PathSkipChecker(skipPaths ...string) security.SkipChecker

PathSkipChecker creates a SkipChecker that skips authorization for specified operation paths.

func WithAuthorizer

func WithAuthorizer(authorizer authz.Authorizer) options.Option

WithAuthorizer provides an Authorizer via a runtime option.

func WithLogger added in v1.3.0

func WithLogger(logger log.Logger) options.Option

WithLogger sets the logger for the middleware.

func WithSkipChecker

func WithSkipChecker(skipChecker security.SkipChecker) options.Option

WithSkipChecker provides a SkipChecker via a runtime option.

Types

type Middleware

type Middleware struct {
	*Options
	// contains filtered or unexported fields
}

Middleware is a Kratos middleware for authorization.

func New

func New(authorizer authz.Authorizer, opts ...options.Option) *Middleware

New is a convenience function for creating a new authorization middleware for manual use.

func (*Middleware) Client

func (m *Middleware) Client() middleware.KMiddleware

Client implements the Kratos middleware.

func (*Middleware) Server

func (m *Middleware) Server() middleware.KMiddleware

Server implements the Kratos middleware.

type Options

type Options struct {
	Authorizer  authz.Authorizer
	SkipChecker security.SkipChecker
	Logger      log.Logger
}

Options holds configurations for the authz middleware.

Jump to

Keyboard shortcuts

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