acl

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Overview

Package acl implements the Access Control List resource. https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.acl2.swagger.json

Index

Constants

View Source
const (
	// ResourceType is the resource type of the Access Control List resource.
	ResourceType = "oic.r.acl2"
	// ResourceURI is the URI of the Access Control List resource.
	ResourceURI = "/oic/sec/acl2"
)

Variables

View Source
var AllResources = []Resource{
	{
		Interfaces: []string{"*"},
		Wildcard:   ResourceWildcard_NONCFG_ALL,
	},
}

Functions

This section is empty.

Types

type AccessControl

type AccessControl struct {
	ID         int           `json:"id,omitempty"`
	Permission Permission    `json:"permission"`
	Resources  []Resource    `json:"resources"`
	Subject    Subject       `json:"subject"`
	Tag        string        `json:"tag,omitempty"`
	Validity   []TimePattern `json:"validity,omitempty"`
}

AccessControl defines permissions for one or more resources.

type ConnectionType

type ConnectionType string
const (
	// authenticated encrypted connection
	ConnectionType_AUTH_CRYPT ConnectionType = "auth-crypt"
	// anonymous clear-text connection
	ConnectionType_ANON_CLEAR ConnectionType = "anon-clear"
)

type Permission

type Permission int

Permission is a bitmask encoding of CRUDN persmissions.

const (
	// Permission_CREATE grants permission for CREATE operations.
	Permission_CREATE Permission = 1
	// Permission_READ grants permission for RETRIEVE, OBSERVE and DISCOVER operations.
	Permission_READ Permission = 2
	// Permission_WRITE grants permission for WRITE and UPDATE operations.
	Permission_WRITE Permission = 4
	// Permission_DELETE grants permission for DELETE operations.
	Permission_DELETE Permission = 8
	// Permission_NOTIFY grants permission for NOTIFY operations.
	Permission_NOTIFY Permission = 16

	// AllPermissions is a convenience bitmask with all available permissions granted.
	AllPermissions = Permission_CREATE | Permission_READ | Permission_WRITE | Permission_DELETE | Permission_NOTIFY
)

func (Permission) Has

func (p Permission) Has(flag Permission) bool

Has returns true if the flag is set.

func (Permission) String

func (p Permission) String() string

type Resource

type Resource struct {
	Href          string           `json:"href,omitempty"`
	Interfaces    []string         `json:"if,omitempty"`
	ResourceTypes []string         `json:"rt,omitempty"`
	Wildcard      ResourceWildcard `json:"wc,omitempty"`
}

type ResourceWildcard

type ResourceWildcard string
const (
	ResourceWildcard_NONCFG_SEC_ENDPOINT    ResourceWildcard = "+"
	ResourceWildcard_NONCFG_NONSEC_ENDPOINT ResourceWildcard = "-"
	ResourceWildcard_NONCFG_ALL             ResourceWildcard = "*"
)

type Response

type Response struct {
	ResourceOwner     string          `json:"rowneruuid"`
	Interfaces        []string        `json:"if"`
	ResourceTypes     []string        `json:"rt"`
	Name              string          `json:"n"`
	AccessControlList []AccessControl `json:"aclist2"`
}

Response contains the supported fields of the Access Control List resource.

type Subject

type Subject struct {
	*Subject_Device
	*Subject_Role
	*Subject_Connection
}

Subject contains anyof/oneof the subtypes

type Subject_Connection

type Subject_Connection struct {
	Type ConnectionType `json:"conntype,omitempty"`
}

type Subject_Device

type Subject_Device struct {
	DeviceID string `json:"uuid,omitempty"`
}

type Subject_Role

type Subject_Role struct {
	Authority string `json:"authority,omitempty"`
	Role      string `json:"role,omitempty"`
}

type TimePattern

type TimePattern struct {
	Period     string `json:"period"`
	Recurrence string `json:"recurrence"`
}

type UpdateRequest

type UpdateRequest struct {
	ResourceOwner     string          `json:"rowneruuid,omitempty"`
	AccessControlList []AccessControl `json:"aclist2"`
}

UpdateRequest is used to update the Access Control List resource.

Jump to

Keyboard shortcuts

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