form

package
v1.0.0-...-f3518ac Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package form enables interactive login without using a web browser.

Index

Constants

View Source
const (
	// InteractionMethod is the methodURLs key
	// used for a URL that can be used for form-based
	// interaction.
	InteractionMethod = "form"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginBody

type LoginBody struct {
	Form map[string]interface{} `json:"form"`
}

LoginBody holds the body of a form login request.

type LoginRequest

type LoginRequest struct {
	httprequest.Route `httprequest:"POST"`
	Body              LoginBody `httprequest:",body"`
}

LoginRequest is a request to perform a login using the provided form.

type SchemaRequest

type SchemaRequest struct {
	httprequest.Route `httprequest:"GET"`
}

SchemaRequest is a request for a form schema.

type SchemaResponse

type SchemaResponse struct {
	Schema environschema.Fields `json:"schema"`
}

SchemaResponse contains the message expected in response to the schema request.

type Visitor

type Visitor struct {
	// Filler holds the form filler that will be used when
	// form-based interaction is required.
	Filler form.Filler
}

Visitor implements httpbakery.Visitor by providing form-based interaction.

func (Visitor) VisitWebPage

func (v Visitor) VisitWebPage(client *httpbakery.Client, methodURLs map[string]*url.URL) error

visitWebPage performs the actual visit request. It attempts to determine that form login is supported and then download the form schema. It calls v.handler.Handle using the downloaded schema and then submits the returned form. Any error produced by v.handler.Handle will not have it's cause masked.

Jump to

Keyboard shortcuts

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