auth

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorize

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

func (*Authorize) Authorize

func (a *Authorize) Authorize(ctx context.Context, opts *types.AuthOptions) (*types.Decision, error)

func (*Authorize) AuthorizeAnyBatch

func (a *Authorize) AuthorizeAnyBatch(ctx context.Context, opts *types.AuthBatchOptions) ([]*types.Decision, error)

func (*Authorize) AuthorizeBatch

func (a *Authorize) AuthorizeBatch(ctx context.Context, opts *types.AuthBatchOptions) ([]*types.Decision, error)

func (*Authorize) ListAuthorizedInstances

func (a *Authorize) ListAuthorizedInstances(ctx context.Context, opts *types.AuthOptions, resourceType types.ResourceType) ([]string, error)

type Authorizer

type Authorizer interface {
	// check if a user's operate resource is already authorized or not.
	Authorize(ctx context.Context, opts *types.AuthOptions) (*types.Decision, error)

	// check if a user's operate resources is authorized or not batch.
	// Note: being authorized resources must be the same resource.
	AuthorizeBatch(ctx context.Context, opts *types.AuthBatchOptions) ([]*types.Decision, error)

	// check if a user have any authority of the operate actions batch.
	AuthorizeAnyBatch(ctx context.Context, opts *types.AuthBatchOptions) ([]*types.Decision, error)

	// list a user's all the authorized resource instance list with an action.
	// Note: opts.Resources is not required.
	// the returned list may be huge, we do not do result paging
	ListAuthorizedInstances(ctx context.Context, opts *types.AuthOptions, resourceType types.ResourceType) ([]string, error)
}

func NewAuth

func NewAuth(conf types.Config, fetcher ResourceFetcher) (Authorizer, error)

type ResourceFetcher

type ResourceFetcher interface {
	// get "same" resource instances with attributes
	// returned with the resource's instance id list matched with options.
	ListInstancesWithAttributes(ctx context.Context, opts *types.ListWithAttributes) (idList []string, err error)
}

Jump to

Keyboard shortcuts

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