mock

package
v2.19.0-incompatible+i... Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package mock implements connectors which help test various server components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCallbackConnector

func NewCallbackConnector(logger log.Logger) connector.Connector

NewCallbackConnector returns a mock connector which requires no user interaction. It always returns the same (fake) identity.

Types

type Callback

type Callback struct {
	// The returned identity.
	Identity connector.Identity
	Logger   log.Logger
}

Callback is a connector that requires no user interaction and always returns the same identity.

func (*Callback) HandleCallback

func (m *Callback) HandleCallback(s connector.Scopes, r *http.Request) (connector.Identity, error)

HandleCallback parses the request and returns the user's identity

func (*Callback) LoginURL

func (m *Callback) LoginURL(s connector.Scopes, callbackURL, state string) (string, error)

LoginURL returns the URL to redirect the user to login with.

func (*Callback) Refresh

Refresh updates the identity during a refresh token request.

type CallbackConfig

type CallbackConfig struct{}

CallbackConfig holds the configuration parameters for a connector which requires no interaction.

func (*CallbackConfig) Open

func (c *CallbackConfig) Open(id string, logger log.Logger) (connector.Connector, error)

Open returns an authentication strategy which requires no user interaction.

type PasswordConfig

type PasswordConfig struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

PasswordConfig holds the configuration for a mock connector which prompts for the supplied username and password.

func (*PasswordConfig) Open

func (c *PasswordConfig) Open(id string, logger log.Logger) (connector.Connector, error)

Open returns an authentication strategy which prompts for a predefined username and password.

Jump to

Keyboard shortcuts

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