Documentation
¶
Index ¶
- Constants
- func NoopSkipper() security.Skipper
- func PathSkipper(skipPaths ...string) security.Skipper
- func WithAuthenticator(authenticator authn.Authenticator) options.Option
- func WithLogger(logger log.Logger) options.Option
- func WithSkipper(skipChecker security.Skipper) options.Option
- type Middleware
- type Options
Constants ¶
View Source
const (
MiddlewareName = "authn"
)
Variables ¶
This section is empty.
Functions ¶
func NoopSkipper ¶ added in v1.4.0
NoopSkipper creates a Skipper that never skips authentication. This is the default behavior.
func PathSkipper ¶ added in v1.4.0
PathSkipper creates a Skipper that skips authentication for specified operation paths. This is provided for convenience, delegating to the common helper.
func WithAuthenticator ¶
func WithAuthenticator(authenticator authn.Authenticator) options.Option
WithAuthenticator provides an Authenticator via a runtime option.
func WithLogger ¶ added in v1.3.0
WithLogger sets the logger for the middleware.
Types ¶
type Middleware ¶
type Middleware struct {
*Options
// contains filtered or unexported fields
}
Middleware is a Kratos middleware for authentication.
func New ¶
func New(authenticator authn.Authenticator, opts ...options.Option) *Middleware
New is a convenience function for creating a new authentication 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.
Click to show internal directories.
Click to hide internal directories.