hexapolicy

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SAnyUser   string = "any"
	SAnyAuth   string = "anyAuthenticated"
	SBasicAuth string = "basic"
	SJwtAuth   string = "jwt"
	SSamlAuth  string = "saml"
	SCidr      string = "net"

	IdqlVersion string = "0.6"
)
View Source
const (
	CompareEqual        string = "EQUAL"
	CompareDifAction    string = "ACTION"
	CompareDifSubject   string = "SUBJECT"
	CompareDifObject    string = "OBJECT"
	CompareDifCondition string = "CONDITION"
)

Variables

View Source
var (
	ChangeTypeNew    = "NEW"
	ChangeTypeEqual  = "MATCHED"
	ChangeTypeUpdate = "UPDATE"
	ChangeTypeDelete = "DELETE"
	ChangeTypeIgnore = "UNSUPPORTED"
)

Functions

This section is empty.

Types

type ActionInfo

type ActionInfo struct {
	ActionUri string `validate:"required"`
}

type MetaInfo

type MetaInfo struct {
	Version      string                 `json:"Version,omitempty" validate:"required"` // this is the idql policy format version
	SourceData   map[string]interface{} `json:",omitempty"`                            // Logistical information required to map in source provider, e.g. type, identifiers
	Description  string                 `json:",omitempty"`
	Created      *time.Time             `json:",omitempty"`
	Modified     *time.Time             `json:",omitempty"`
	Etag         string                 `json:",omitempty"`
	PolicyId     *string                `json:",omitempty"`
	PapId        *string                `json:",omitempty"`
	ProviderType string                 `json:",omitempty"`
}

type ObjectInfo

type ObjectInfo struct {
	ResourceID string `json:"resource_id" validate:"required"`
}

type Policies

type Policies struct {
	Policies []PolicyInfo `json:"policies"`
	App      *string      `json:"app,omitempty"`
}

func (*Policies) AddPolicies

func (p *Policies) AddPolicies(policies Policies)

func (*Policies) AddPolicy

func (p *Policies) AddPolicy(info PolicyInfo)

func (*Policies) CalculateEtags added in v0.6.1

func (p *Policies) CalculateEtags()

func (*Policies) ReconcilePolicies added in v0.6.1

func (p *Policies) ReconcilePolicies(comparePolicies []PolicyInfo, diffsOnly bool) []PolicyDif

type PolicyDif added in v0.6.1

type PolicyDif struct {
	Type          string
	PolicyId      string
	Hash          string
	DifTypes      []string
	PolicyExist   *[]PolicyInfo // for n to 1
	PolicyCompare *PolicyInfo
}

func (*PolicyDif) Report added in v0.6.1

func (d *PolicyDif) Report() string

type PolicyInfo

type PolicyInfo struct {
	Meta      MetaInfo                  `validate:"required"`
	Subject   SubjectInfo               `validate:"required"`
	Actions   []ActionInfo              `validate:"required"`
	Object    ObjectInfo                `validate:"required"`
	Condition *conditions.ConditionInfo `json:",omitempty"` // Condition is optional
}

func (*PolicyInfo) CalculateEtag added in v0.6.1

func (p *PolicyInfo) CalculateEtag() string

CalculateEtag calculates an ETAG hash value for the policy which includes the Subject, Actions, Object, and Conditions objects only

func (*PolicyInfo) Compare added in v0.6.1

func (p *PolicyInfo) Compare(hexaPolicy PolicyInfo) []string

func (*PolicyInfo) Equals added in v0.6.1

func (p *PolicyInfo) Equals(hexaPolicy PolicyInfo) bool

Equals compares values to determine if the policies are equal. Note: does NOT compare meta information.

func (*PolicyInfo) String added in v0.6.1

func (p *PolicyInfo) String() string

type PolicyInfoSaurabh added in v0.6.1

type PolicyInfoSaurabh struct {
	Name string
}

type PolicyInfoSaurabhV2 added in v0.6.1

type PolicyInfoSaurabhV2 struct {
	Name string
}

type SubjectInfo

type SubjectInfo struct {
	Members []string `validate:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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