node

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOTPCode      = "totp_code"
	TOTPSecretKey = "totp_secret_key"
	TOTPQR        = "totp_qr"
	TOTPUnlink    = "totp_unlink"
)
View Source
const (
	LookupReveal     = "lookup_secret_reveal"
	LookupRegenerate = "lookup_secret_regenerate"
	LookupDisable    = "lookup_secret_disable"
	LookupCodes      = "lookup_secret_codes"
	LookupConfirm    = "lookup_secret_confirm"
	LookupCodeEnter  = "lookup_secret"
)
View Source
const (
	WebAuthnRegisterTrigger     = "webauthn_register_trigger"
	WebAuthnRegister            = "webauthn_register"
	WebAuthnLogin               = "webauthn_login"
	WebAuthnLoginTrigger        = "webauthn_login_trigger"
	WebAuthnRegisterDisplayName = "webauthn_register_displayname"
	WebAuthnRemove              = "webauthn_remove"
	WebAuthnScript              = "webauthn_script"
)
View Source
const DisableFormField = "disableFormField"

Variables

This section is empty.

Functions

func PasswordLoginOrder

func PasswordLoginOrder(in []string) []string

func SortByGroups

func SortByGroups(orderByGroups []UiNodeGroup) func(*sortOptions)

func SortBySchema

func SortBySchema(schemaRef string) func(*sortOptions)

func SortUpdateOrder

func SortUpdateOrder(f func([]string) []string) func(*sortOptions)

func SortUseOrder

func SortUseOrder(keysInOrder []string) func(*sortOptions)

func SortUseOrderAppend

func SortUseOrderAppend(keysInOrder []string) func(*sortOptions)

func WithImageAttributes

func WithImageAttributes(f func(a *ImageAttributes)) func(a *ImageAttributes)

func WithInputAttributes

func WithInputAttributes(f func(a *InputAttributes)) func(a *InputAttributes)

func WithRequiredInputAttribute

func WithRequiredInputAttribute(a *InputAttributes)

func WithScriptAttributes

func WithScriptAttributes(f func(a *ScriptAttributes)) func(a *ScriptAttributes)

Types

type AnchorAttributes

type AnchorAttributes struct {
	// The link's href (destination) URL.
	//
	// format: uri
	// required: true
	HREF string `json:"href"`

	// The link's title.
	//
	// required: true
	Title *text.Message `json:"title"`

	// A unique identifier
	//
	// required: true
	Identifier string `json:"id"`

	// NodeType represents this node's types. It is a mirror of `node.type` and
	// is primarily used to allow compatibility with OpenAPI 3.0.  In this struct it technically always is "a".
	//
	// required: true
	NodeType string `json:"node_type"`
}

AnchorAttributes represents the attributes of an anchor node.

swagger:model uiNodeAnchorAttributes

func (*AnchorAttributes) GetNodeType

func (a *AnchorAttributes) GetNodeType() UiNodeType

func (*AnchorAttributes) GetValue

func (a *AnchorAttributes) GetValue() interface{}

func (*AnchorAttributes) ID

func (a *AnchorAttributes) ID() string

func (*AnchorAttributes) Reset

func (a *AnchorAttributes) Reset()

func (*AnchorAttributes) SetValue

func (a *AnchorAttributes) SetValue(value interface{})

type Attributes

type Attributes interface {
	// swagger:ignore
	ID() string

	// swagger:ignore
	Reset()

	// swagger:ignore
	SetValue(value interface{})

	// swagger:ignore
	GetValue() interface{}

	// swagger:ignore
	GetNodeType() UiNodeType
}

Attributes represents a list of attributes (e.g. `href="foo"` for links).

swagger:model uiNodeAttributes

type ImageAttributes

type ImageAttributes struct {
	// The image's source URL.
	//
	// format: uri
	// required: true
	Source string `json:"src"`

	// A unique identifier
	//
	// required: true
	Identifier string `json:"id"`

	// Width of the image
	//
	// required: true
	Width int `json:"width"`

	// Height of the image
	//
	// required: true
	Height int `json:"height"`

	// NodeType represents this node's types. It is a mirror of `node.type` and
	// is primarily used to allow compatibility with OpenAPI 3.0.  In this struct it technically always is "img".
	//
	// required: true
	NodeType string `json:"node_type"`
}

ImageAttributes represents the attributes of an image node.

swagger:model uiNodeImageAttributes

func (*ImageAttributes) GetNodeType

func (a *ImageAttributes) GetNodeType() UiNodeType

func (*ImageAttributes) GetValue

func (a *ImageAttributes) GetValue() interface{}

func (*ImageAttributes) ID

func (a *ImageAttributes) ID() string

func (*ImageAttributes) Reset

func (a *ImageAttributes) Reset()

func (*ImageAttributes) SetValue

func (a *ImageAttributes) SetValue(value interface{})

type ImageAttributesModifier

type ImageAttributesModifier func(attributes *ImageAttributes)

type ImageAttributesModifiers

type ImageAttributesModifiers []ImageAttributesModifier

type InputAttributeType

type InputAttributeType string

swagger:model uiNodeInputAttributeType

const (
	InputAttributeTypeText          InputAttributeType = "text"
	InputAttributeTypePassword      InputAttributeType = "password"
	InputAttributeTypeNumber        InputAttributeType = "number"
	InputAttributeTypeCheckbox      InputAttributeType = "checkbox"
	InputAttributeTypeHidden        InputAttributeType = "hidden"
	InputAttributeTypeEmail         InputAttributeType = "email"
	InputAttributeTypeSubmit        InputAttributeType = "submit"
	InputAttributeTypeButton        InputAttributeType = "button"
	InputAttributeTypeDateTimeLocal InputAttributeType = "datetime-local"
	InputAttributeTypeDate          InputAttributeType = "date"
	InputAttributeTypeURI           InputAttributeType = "url"
)

type InputAttributes

type InputAttributes struct {
	// The input's element name.
	//
	// required: true
	Name string `json:"name"`

	// The input's element type.
	//
	// required: true
	Type InputAttributeType `json:"type" faker:"-"`

	// The input's value.
	FieldValue interface{} `json:"value,omitempty" faker:"string"`

	// Mark this input field as required.
	Required bool `json:"required,omitempty"`

	// The input's label text.
	Label *text.Message `json:"label,omitempty"`

	// The input's pattern.
	Pattern string `json:"pattern,omitempty"`

	// Sets the input's disabled field to true or false.
	//
	// required: true
	Disabled bool `json:"disabled"`

	// OnClick may contain javascript which should be executed on click. This is primarily
	// used for WebAuthn.
	OnClick string `json:"onclick,omitempty"`

	// NodeType represents this node's types. It is a mirror of `node.type` and
	// is primarily used to allow compatibility with OpenAPI 3.0.  In this struct it technically always is "input".
	//
	// required: true
	NodeType string `json:"node_type"`
}

InputAttributes represents the attributes of an input node

swagger:model uiNodeInputAttributes

func (*InputAttributes) GetNodeType

func (a *InputAttributes) GetNodeType() UiNodeType

func (*InputAttributes) GetValue

func (a *InputAttributes) GetValue() interface{}

func (*InputAttributes) ID

func (a *InputAttributes) ID() string

func (*InputAttributes) Reset

func (a *InputAttributes) Reset()

func (*InputAttributes) SetValue

func (a *InputAttributes) SetValue(value interface{})

type InputAttributesModifier

type InputAttributesModifier func(attributes *InputAttributes)

type InputAttributesModifiers

type InputAttributesModifiers []InputAttributesModifier

type Meta

type Meta struct {
	// Label represents the node's label.
	//
	// Keep in mind that these values are autogenerated and can not be changed.
	// If you wish to use other titles or labels implement that directly in
	// your UI.
	Label *text.Message `json:"label,omitempty"`
}

A Node's Meta Information

This might include a label and other information that can optionally be used to render UIs.

swagger:model uiNodeMeta

type Node

type Node struct {
	// The node's type
	//
	// required: true
	Type UiNodeType `json:"type" faker:"-"`

	// Group specifies which group (e.g. password authenticator) this node belongs to.
	//
	// required: true
	Group UiNodeGroup `json:"group"`

	// The node's attributes.
	//
	// required: true
	// swagger:type uiNodeAttributes
	Attributes Attributes `json:"attributes" faker:"ui_node_attributes"`

	// The node's messages
	//
	// Contains error, validation, or other messages relevant to this node.
	//
	// required: true
	Messages text.Messages `json:"messages"`

	// Meta contains a node meta information
	//
	// This might include a label and other information that can optionally
	// be used to render UIs.
	//
	// required: true
	Meta *Meta `json:"meta"`
}

Node represents a flow's nodes

Nodes are represented as HTML elements or their native UI equivalents. For example, a node can be an `<img>` tag, or an `<input element>` but also `some plain text`.

swagger:model uiNode

func NewAnchorField

func NewAnchorField(id string, href string, group UiNodeGroup, title *text.Message) *Node

func NewCSRFNode

func NewCSRFNode(token string) *Node

func NewImageField

func NewImageField(id string, src string, group UiNodeGroup, opts ...ImageAttributesModifier) *Node

func NewInputField

func NewInputField(name string, value interface{}, group UiNodeGroup, inputType InputAttributeType, opts ...InputAttributesModifier) *Node

func NewInputFieldFromJSON

func NewInputFieldFromJSON(name string, value interface{}, group UiNodeGroup, opts ...InputAttributesModifier) *Node

func NewInputFieldFromSchema

func NewInputFieldFromSchema(name string, group UiNodeGroup, p jsonschemax.Path, opts ...InputAttributesModifier) *Node

func NewScriptField

func NewScriptField(name string, src string, group UiNodeGroup, integrity string, opts ...ScriptAttributesModifier) *Node

func NewTextField

func NewTextField(id string, text *text.Message, group UiNodeGroup) *Node

func (*Node) GetValue

func (n *Node) GetValue() interface{}

func (*Node) ID

func (n *Node) ID() string

func (*Node) MarshalJSON

func (n *Node) MarshalJSON() ([]byte, error)

func (*Node) Reset

func (n *Node) Reset()

func (*Node) UnmarshalJSON

func (n *Node) UnmarshalJSON(data []byte) error

func (*Node) WithMetaLabel

func (n *Node) WithMetaLabel(label *text.Message) *Node

type Nodes

type Nodes []*Node

swagger:model uiNodes

func (*Nodes) Append

func (n *Nodes) Append(node *Node)

Append appends a node.

func (Nodes) Find

func (n Nodes) Find(id string) *Node

func (*Nodes) Remove

func (n *Nodes) Remove(ids ...string)

Remove removes one or more nodes by their IDs.

func (Nodes) Reset

func (n Nodes) Reset(exclude ...string)

func (Nodes) ResetNodes

func (n Nodes) ResetNodes(reset ...string)

func (Nodes) ResetNodesWithPrefix

func (n Nodes) ResetNodesWithPrefix(prefix string)

func (*Nodes) SetValueAttribute

func (n *Nodes) SetValueAttribute(id string, value interface{}) bool

SetValueAttribute sets a node's attribute's value or returns false if no node is found.

func (Nodes) SortBySchema

func (n Nodes) SortBySchema(ctx context.Context, opts ...SortOption) error

func (*Nodes) Upsert

func (n *Nodes) Upsert(node *Node)

Upsert updates or appends a node.

type ScriptAttributes

type ScriptAttributes struct {
	// The script source
	//
	// required: true
	Source string `json:"src"`

	// The script async type
	//
	// required: true
	Async bool `json:"async"`

	// The script referrer policy
	//
	// required: true
	ReferrerPolicy string `json:"referrerpolicy"`

	// The script cross origin policy
	//
	// required: true
	CrossOrigin string `json:"crossorigin"`

	// The script's integrity hash
	//
	// required: true
	Integrity string `json:"integrity"`

	// The script MIME type
	//
	// required: true
	Type string `json:"type"`

	// A unique identifier
	//
	// required: true
	Identifier string `json:"id"`

	// Nonce for CSP
	//
	// A nonce you may want to use to improve your Content Security Policy.
	// You do not have to use this value but if you want to improve your CSP
	// policies you may use it. You can also choose to use your own nonce value!
	//
	// required: true
	Nonce string `json:"nonce"`

	// NodeType represents this node's types. It is a mirror of `node.type` and
	// is primarily used to allow compatibility with OpenAPI 3.0. In this struct it technically always is "script".
	//
	// required: true
	NodeType string `json:"node_type"`
}

ScriptAttributes represent script nodes which load javascript.

swagger:model uiNodeScriptAttributes

func (*ScriptAttributes) GetNodeType

func (a *ScriptAttributes) GetNodeType() UiNodeType

func (*ScriptAttributes) GetValue

func (a *ScriptAttributes) GetValue() interface{}

func (*ScriptAttributes) ID

func (a *ScriptAttributes) ID() string

func (*ScriptAttributes) Reset

func (a *ScriptAttributes) Reset()

func (*ScriptAttributes) SetValue

func (a *ScriptAttributes) SetValue(value interface{})

type ScriptAttributesModifier

type ScriptAttributesModifier func(attributes *ScriptAttributes)

type ScriptAttributesModifiers

type ScriptAttributesModifiers []ScriptAttributesModifier

type SortOption

type SortOption func(*sortOptions)

type TextAttributes

type TextAttributes struct {
	// The text of the text node.
	//
	// required: true
	Text *text.Message `json:"text"`

	// A unique identifier
	//
	// required: true
	Identifier string `json:"id"`

	// NodeType represents this node's types. It is a mirror of `node.type` and
	// is primarily used to allow compatibility with OpenAPI 3.0.  In this struct it technically always is "text".
	//
	// required: true
	NodeType string `json:"node_type"`
}

TextAttributes represents the attributes of a text node.

swagger:model uiNodeTextAttributes

func (*TextAttributes) GetNodeType

func (a *TextAttributes) GetNodeType() UiNodeType

func (*TextAttributes) GetValue

func (a *TextAttributes) GetValue() interface{}

func (*TextAttributes) ID

func (a *TextAttributes) ID() string

func (*TextAttributes) Reset

func (a *TextAttributes) Reset()

func (*TextAttributes) SetValue

func (a *TextAttributes) SetValue(value interface{})

type UiNodeGroup

type UiNodeGroup string

swagger:enum UiNodeGroup

const (
	DefaultGroup       UiNodeGroup = "default"
	PasswordGroup      UiNodeGroup = "password"
	OpenIDConnectGroup UiNodeGroup = "oidc"
	ProfileGroup       UiNodeGroup = "profile"
	LinkGroup          UiNodeGroup = "link"
	TOTPGroup          UiNodeGroup = "totp"
	LookupGroup        UiNodeGroup = "lookup_secret"
	WebAuthnGroup      UiNodeGroup = "webauthn"
)

func (UiNodeGroup) String

func (g UiNodeGroup) String() string

type UiNodeType

type UiNodeType string

swagger:enum UiNodeType

const (
	Text   UiNodeType = "text"
	Input  UiNodeType = "input"
	Image  UiNodeType = "img"
	Anchor UiNodeType = "a"
	Script UiNodeType = "script"
)

func (UiNodeType) String

func (t UiNodeType) String() string

Jump to

Keyboard shortcuts

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