auth

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package auth 提供 grpc-kit 微服务脚手架的认证授权模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 认证鉴权客户端

func NewClient

func NewClient(ctx context.Context, config *Config) (*Client, error)

NewClient 初始化实例

func (*Client) Allow

func (c *Client) Allow(ctx context.Context) (bool, error)

Allow 是否满足策略允许访问

func (*Client) AuthMetadata

func (c *Client) AuthMetadata(ctx context.Context, req *http.Request) context.Context

AuthMetadata 把 http 请求信息转换为 grpc 的 metadata 用于鉴权

func (*Client) Close

func (c *Client) Close(ctx context.Context)

Close 关闭释放资源

func (*Client) GetRBACData added in v0.3.8

func (c *Client) GetRBACData() *rbacv3.RBAC

func (*Client) WithLoggerOption

func (c *Client) WithLoggerOption(logger *logrus.Entry) *Client

WithLoggerOption 设置日志记录器

type Config

type Config struct {
	PackageName string
	OPASDK      *OPASDKConfig
	OPARego     *OPARegoConfig
	OPAEnvoy    *OPAEnvoyPluginConfig
}

Config xx

type OPAEnvoyPluginConfig

type OPAEnvoyPluginConfig struct {
	GRPCAddress string
}

type OPARegoConfig

type OPARegoConfig struct {
	RegoBody []byte
	DataBody []byte
}

type OPASDKConfig

type OPASDKConfig struct {
	Config string
}

Jump to

Keyboard shortcuts

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