auth

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BASIC int = iota
	GRANT
)

Variables

This section is empty.

Functions

func AuthProcess

func AuthProcess(ctx context.Context, auth *Authorizer, checkType int, req interface{}) error

func Authenticate

func Authenticate() middleware.Middleware

func Authorize

func Authorize(c *conf.Server, checkType int) middleware.Middleware

func FromAuthContext

func FromAuthContext(ctx context.Context) string

func GetSecretData

func GetSecretData(ctx context.Context, req interface{}) (user, resource, action string, err error)

func GetUsername

func GetUsername(req *http.Request) (string, error)

func NewAuthContext

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

Types

type AuthUser

type AuthUser struct{}

type Authorizer

type Authorizer struct {
	ACLWatcher *fsnotify.Watcher
	// contains filtered or unexported fields
}

func NewAuthorizer

func NewAuthorizer(c *conf.Server_Authorization, nautesCFG *conf.Nautes) (*Authorizer, error)

func (*Authorizer) CheckGrantPermission

func (a *Authorizer) CheckGrantPermission(_ context.Context, user, resource string, dstUser *v1.GrantTarget) error

Grant check flow 1. Request are not in black list (blacklist is a regex list, current use to block runtime grant the role in tenant cluster) 2. User has grant permission in resource acl 3. User can grant resource to user

func (*Authorizer) CheckSecretPermission

func (a *Authorizer) CheckSecretPermission(_ context.Context, user, resource, action string) error

type Transport

type Transport interface {
	Request() *http.Request
}

Jump to

Keyboard shortcuts

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