clientauth

package
v0.0.0-...-7570391 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationKey = "authorization"
	BearerPrefix     = "Bearer "
)

Variables

View Source
var (
	AnonymousUserInfo = UserInfo{Role: RoleAnonymous, User: "anonymous"}
	NoauthUserInfo    = UserInfo{Role: RoleAdmin, User: "auth-disabled"}
)
View Source
var ErrZeroVerifiedChains = errors.New("AuthProvider could not find a client cert.")
View Source
var ErrZeroVerifiedChains2 = errors.New("AuthProvider requires len(VerifiedChains[0]) > 0.")

Functions

func ContextWithUserInfo

func ContextWithUserInfo(ctx context.Context, ui UserInfo) context.Context

func IsValidRoleStr

func IsValidRoleStr(s string) bool

func RequireRoleGRPC

func RequireRoleGRPC(ctx context.Context, req Role) error

Types

type AuthProvider

type AuthProvider struct {
	Disabled bool
}

func (AuthProvider) UnaryServerInterceptor

func (p AuthProvider) UnaryServerInterceptor() grpc.UnaryServerInterceptor

type Role

type Role int
const (
	RoleAnonymous Role = iota
	RoleReadOnly
	RoleAdmin
)

func RoleFromStr

func RoleFromStr(s string) Role

func (Role) String

func (r Role) String() string

type UserInfo

type UserInfo struct {
	Role
	User string
}

func UserInfoFromClientCert

func UserInfoFromClientCert(cert *x509.Certificate) UserInfo

func UserInfoFromContext

func UserInfoFromContext(ctx context.Context) UserInfo

func UserInfoFromTLSConnectionState

func UserInfoFromTLSConnectionState(tcs *tls.ConnectionState) (UserInfo, error)

func (UserInfo) String

func (ui UserInfo) String() string

Jump to

Keyboard shortcuts

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