iotauth

package
v0.0.0-...-99fe3a6 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCost = 11
)

Variables

This section is empty.

Functions

func GenerateSnapdAuthFiles

func GenerateSnapdAuthFiles(usersAndPasswords map[string]string)

func SS

func SS(str string) []string

Creates a slice with a single string in it

func StoreNatsParameters

func StoreNatsParameters(username, hashedPassword, filename string) error

Types

type PermissionMap

type PermissionMap struct {
	Allow []string `json:"allow,omitempty"`
	Deny  []string `json:"deny,omitempty"`
}

PermissionMap

type Permissions

type Permissions struct {
	Publish   *PermissionsProperty `json:"publish,omitempty"`
	Subscribe *PermissionsProperty `json:"subscribe,omitempty"`
}

Permissions

type PermissionsProperty

type PermissionsProperty struct {
	PermissionMap *PermissionMap `json:"permissionMap,omitempty"`
	Subject       []string       `json:"subject,omitempty"`
}

PermissionsProperty

func NewPermMapPermsProp

func NewPermMapPermsProp(allow []string, deny []string) *PermissionsProperty

Create a new Permissions Property that contains a permissions map (see https://docs.nats.io/nats-server/configuration/securing_nats/authorization#permission-map)

func NewSubjectPermsProp

func NewSubjectPermsProp(subject []string) *PermissionsProperty

Creates a new Permissions Property that contains a list of subjects (see https://docs.nats.io/nats-server/configuration/securing_nats/authorization#permissions-configuration-map)

type User

type User struct {
	DefaultPublishDeny   []string     `json:"defaultPublishDeny,omitempty"`
	DefaultSubscribeDeny []string     `json:"defaultSubscribeDeny,omitempty"`
	Hash                 string       `json:"hash,omitempty"`
	Name                 string       `json:"name"`
	Permissions          *Permissions `json:"permissions,omitempty"`
}

User

func (*User) Store

func (user *User) Store(filepath string) error

Stores the nats user (jsonified) in the file specified by filepath

Jump to

Keyboard shortcuts

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