auth

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const TokenType = "Bearer"

Variables

This section is empty.

Functions

func GetUser

func GetUser(ctx context.Context) string

func SetUser

func SetUser(ctx context.Context, user string) context.Context

func StreamServerInterceptor

func StreamServerInterceptor() grpc.StreamServerInterceptor

func UnaryServerInterceptor

func UnaryServerInterceptor(authFunc AuthorizationFunc) grpc.UnaryServerInterceptor

Types

type Auth

type Auth struct {
	Authentication authentication.Authentication
	Authorization  authorization.Authorization

	RoleClient  authorization.RoleClient
	TokenClient authentication.TokenClient
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(config Config, cluster cluster.Cluster) *Auth

func (*Auth) Authenticate

func (a *Auth) Authenticate(ctx context.Context) (context.Context, error)

func (*Auth) Authorize

func (a *Auth) Authorize(ctx context.Context, method string, req interface{}) error

func (*Auth) Disable

func (a *Auth) Disable() bool

func (*Auth) GetRoleClient

func (a *Auth) GetRoleClient() authorization.RoleClient

func (*Auth) OpenEventbus

func (a *Auth) OpenEventbus() bool

func (*Auth) OpenSubscription

func (a *Auth) OpenSubscription() bool

func (*Auth) RegisterAuthorizeFunc

func (a *Auth) RegisterAuthorizeFunc(method string, authorizeFunc AuthorizeFunc)

type AuthorizationFunc

type AuthorizationFunc func(ctx context.Context, method string, req interface{}) (err error)

type AuthorizeFunc

type AuthorizeFunc func(ctx context.Context,
	req interface{}) (authorization.ResourceKind, vanus.ID, authorization.Action)

type Config

type Config struct {
	Disable          bool
	OpenEventbus     bool
	OpenSubscription bool
}

Jump to

Keyboard shortcuts

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