caveats

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSeekblessingsCancelled = fmt.Errorf("seekblessings has been cancelled")

Functions

This section is empty.

Types

type CaveatFactory

type CaveatFactory interface {
	New(caveatInfo CaveatInfo) (security.Caveat, error)
}

func NewCaveatFactory

func NewCaveatFactory() CaveatFactory

type CaveatInfo

type CaveatInfo struct {
	Type string
	Args []interface{}
}

type CaveatSelector

type CaveatSelector interface {
	// Render renders the caveat input form. When the user has completed inputing caveats,
	// Render should redirect to the specified redirect route.
	// blessingName is the name used for the blessings that is being caveated.
	// state is any state passed by the caller (e.g., for CSRF mitigation) and is returned by ParseSelections.
	// redirectRoute is the route to be returned to.
	Render(blessingName, state, redirectURL string, w http.ResponseWriter, r *http.Request) error
	// ParseSelections parse the users choices of Caveats, and returns the information needed to create them,
	// the state passed to Render, and any additionalExtension selected by the user to further extend the blessing.
	ParseSelections(r *http.Request) (caveats []CaveatInfo, state string, additionalExtension string, err error)
}

CaveatSelector is used to render a web page where the user can select caveats to be added to a blessing being granted

func NewBrowserCaveatSelector

func NewBrowserCaveatSelector(assetsPrefix string) CaveatSelector

NewBrowserCaveatSelector returns a caveat selector that renders a form in the to accept user caveat selections.

func NewMockCaveatSelector

func NewMockCaveatSelector() CaveatSelector

NewMockCaveatSelector returns a CaveatSelector that always returns a default set of caveats: [exprity caveat with a 1h expiry, revocation caveat, and a method caveat for methods "methodA" and "methodB"] and the additional extension: "test-extension" This selector is only meant to be used during testing.

Jump to

Keyboard shortcuts

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