bakerytest

package
v0.0.0-...-7ab5879 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2015 License: LGPL-3.0 Imports: 5 Imported by: 2

Documentation

Overview

Package bakerytest provides test helper functions for the bakery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discharger

type Discharger struct {
	Service *bakery.Service
	// contains filtered or unexported fields
}

Discharger is a third-party caveat discharger suitable for testing. It listens on a local network port for discharge requests. It should be shut down by calling Close when done with.

func NewDischarger

func NewDischarger(
	locator bakery.PublicKeyLocator,
	checker func(req *http.Request, cond, arg string) ([]checkers.Caveat, error),
) *Discharger

NewDischarger returns a new third party caveat discharger which uses the given function to check caveats. The cond and arg arguments to the function are as returned by checkers.ParseCaveat.

If locator is non-nil, it will be used to find public keys for any third party caveats returned by the checker.

func (*Discharger) Close

func (d *Discharger) Close()

Close shuts down the server.

func (*Discharger) Location

func (d *Discharger) Location() string

Location returns the location of the discharger, suitable for setting as the location in a third party caveat. This will be the URL of the server.

func (*Discharger) PublicKeyForLocation

func (d *Discharger) PublicKeyForLocation(loc string) (*bakery.PublicKey, error)

PublicKeyForLocation implements bakery.PublicKeyLocator.

Jump to

Keyboard shortcuts

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