test

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2018 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package test contains an identity provider useful for testing other parts of the system. The test identity provider is insecure by design so should not be used in any production system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIdentityProvider

func NewIdentityProvider(p Params) idp.IdentityProvider

NewIdentityProvider creates an idp.IdentityProvider that can be used for tests.

Types

type Interactor

type Interactor struct {
	// User contains the user to log in as. User may be fully defined
	// in which case the user is added to the database or can be a
	// Username or ExternalID. If the latter two cases the database
	// will be checked for a matching user.
	User *params.User

	// Doer contatins an httprequest.Doer that will be used with
	// OpenWebPage.
	Doer httprequest.Doer
}

func (Interactor) Interact

func (i Interactor) Interact(ctx context.Context, client *httpbakery.Client, location string, ierr *httpbakery.Error) (*httpbakery.DischargeToken, error)

Interact implements httpbakery.Interactor.Interact.

func (Interactor) Kind

func (i Interactor) Kind() string

Kind implements httpbakery.Interactor.Kind.

func (Interactor) LegacyInteract

func (i Interactor) LegacyInteract(ctx context.Context, client *httpbakery.Client, location string, u *url.URL) error

LegacyInteract implements httpbakery.LegacyInteractor.LegacyInteract.

func (Interactor) OpenWebBrowser

func (i Interactor) OpenWebBrowser(u *url.URL) error

OpenWebBrowser implements an OpenWebBrowser function for use with httpbakery.WebBrowserInteractor.

type Params

type Params struct {
	// Name is the name that will be used with the identity provider.
	Name string

	// Domain contains the domain that will be used with the identity
	// provider.
	Domain string

	// GetGroups contains function that if set will be called by
	// GetGroups to obtain the groups to return.
	GetGroups func(*store.Identity) ([]string, error)
}

Jump to

Keyboard shortcuts

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