authz

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Authorization package

Index

Constants

View Source
const (
	// Actions
	ActionRead   = "read"
	ActionList   = "list"
	ActionUpdate = "update"
	ActionDelete = "delete"

	// Resources
	ResourceWorkflowContract = "workflow_contract"
	ResourceCASArtifact      = "cas_artifact"
	ResourceReferrer         = "referrer"
)

Variables

View Source
var (
	PolicyWorkflowContractList   = &Policy{ResourceWorkflowContract, ActionList}
	PolicyWorkflowContractRead   = &Policy{ResourceWorkflowContract, ActionRead}
	PolicyWorkflowContractUpdate = &Policy{ResourceWorkflowContract, ActionUpdate}
	PolicyArtifactDownload       = &Policy{ResourceCASArtifact, ActionRead}
	PolicyReferrerRead           = &Policy{ResourceReferrer, ActionRead}
)

Functions

This section is empty.

Types

type Enforcer

type Enforcer struct {
	*casbin.Enforcer
}

func NewDatabaseEnforcer

func NewDatabaseEnforcer(c *conf.Data_Database) (*Enforcer, error)

NewDatabaseEnforcer creates a new casbin authorization enforcer based on a database backend as policies storage backend

func NewFiletypeEnforcer

func NewFiletypeEnforcer(path string) (*Enforcer, error)

NewFileAdapter creates a new casbin authorization enforcer based on a CSV file as policies storage backend

func (*Enforcer) AddPolicies

func (e *Enforcer) AddPolicies(sub *SubjectAPIToken, policies ...*Policy) error

func (*Enforcer) ClearPolicies

func (e *Enforcer) ClearPolicies(sub *SubjectAPIToken) error

Remove all the policies for the given subject

type Policy

type Policy struct {
	Resource string
	Action   string
}

resource, action tuple

type SubjectAPIToken

type SubjectAPIToken struct {
	ID string
}

func (*SubjectAPIToken) String

func (t *SubjectAPIToken) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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