security

package
v0.0.0-...-2af02f3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 87

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, security Context) context.Context

NewContext returns context with security context

Types

type Context

type Context interface {
	// Name returns the name of the security context
	Name() string
	// IsAuthenticated returns whether the context has been authenticated or not
	IsAuthenticated() bool
	// GetUsername returns the username of user related to the context
	GetUsername() string
	// IsSysAdmin returns whether the user is system admin
	IsSysAdmin() bool
	// IsSolutionUser returns whether the user is solution user
	IsSolutionUser() bool
	// Can returns whether the user can do action on resource
	Can(ctx context.Context, action types.Action, resource types.Resource) bool
}

Context abstracts the operations related with authN and authZ

func FromContext

func FromContext(ctx context.Context) (Context, bool)

FromContext returns security context from the context

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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