authentication

package
v0.0.0-...-421612b Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Admin = "admin"
	Root  = "root"
)

Variables

This section is empty.

Functions

func IsValidAuth

func IsValidAuth(ctx context.Context) error

IsValidAuth 具体的验证逻辑

Types

type MyAuth

type MyAuth struct {
	Username string
	Password string
}

MyAuth 自定义 Auth 需要实现 credentials.PerRPCCredentials 接口

func NewMyAuth

func NewMyAuth() *MyAuth

func (*MyAuth) GetRequestMetadata

func (a *MyAuth) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

GetRequestMetadata 定义授权信息的具体存放形式,最终会按这个格式存放到 metadata map 中。

func (*MyAuth) RequireTransportSecurity

func (a *MyAuth) RequireTransportSecurity() bool

RequireTransportSecurity 是否需要基于 TLS 加密连接进行安全传输

Directories

Path Synopsis
The client demonstrates how to supply an OAuth2 token for every RPC.
The client demonstrates how to supply an OAuth2 token for every RPC.
The server demonstrates how to consume and validate OAuth2 tokens provided by clients for each RPC.
The server demonstrates how to consume and validate OAuth2 tokens provided by clients for each RPC.

Jump to

Keyboard shortcuts

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