auth

package module
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongContext          = errors.Unauthorized(reason, "wrong context for middleware")
	ErrMissingJwtToken       = errors.Unauthorized(reason, "no jwt token in context")
	ErrExtractUserInfoFailed = errors.Unauthorized(reason, "extract user info failed")
	ErrExtractSubjectFailed  = errors.Unauthorized(reason, "extract subject failed")
	ErrExtractTenantFailed   = errors.Unauthorized(reason, "extract tenant failed")
	ErrAccessTokenNotExist   = errors.Unauthorized(reason, "access token do not exists")
	ErrAccessTokenExpired    = errors.Unauthorized(reason, "access token expired")
)
View Source
var Action = authzEngine.Action("ANY")

Functions

func FromContext

func FromContext(ctx context.Context) (*data.UserTokenPayload, error)

func NewAuthMiddleware

func NewAuthMiddleware(authenticator engine.RequestAuthenticator,
	authorizer authzEngine.Engine,
	userToken *data.UserToken, cfg *configv1.Authentication_Jwt) middleware.Middleware

NewAuthMiddleware 创建统一鉴权中间件,并按白名单规则决定鉴权链路。

func OptionalServer

func OptionalServer(authenticator engine.RequestAuthenticator, userToken *data.UserToken) middleware.Middleware

OptionalServer 为白名单接口补充可选认证解析。

func Server

func Server(userToken *data.UserToken) middleware.Middleware

Server 衔接认证和权鉴

Types

This section is empty.

Directories

Path Synopsis
authn module
engine/jwt module
middleware module
authz module
engine/casbin module
middleware module

Jump to

Keyboard shortcuts

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