idputil

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: 7 Imported by: 0

Documentation

Overview

Package idputil contains utility routines common to many identity providers.

Index

Constants

This section is empty.

Variables

View Source
var ReservedUsernames = map[string]bool{
	"admin":    true,
	"everyone": true,
}

Functions

func DischargeID

func DischargeID(req *http.Request) string

WaitID gets the wait ID from the given request using the standard form value.

func GetLoginMethods

func GetLoginMethods(ctx context.Context, c *httprequest.Client, u *url.URL, v interface{}) error

GetLoginMethods uses c to perform a request to get the list of available login methods from u. The result is unmarshalled into v.

func NameWithDomain

func NameWithDomain(name, domain string) string

NameWithDomain builds a name out of name and domain. If domain is empty then name is returned unchanged.

func RegistrationForm

func RegistrationForm(ctx context.Context, w http.ResponseWriter, params RegistrationParams, t *template.Template) error

RegistrationForm writes a registration form to the given writer using the given parameters.

func RequestParams

func RequestParams(ctx context.Context, w http.ResponseWriter, req *http.Request) httprequest.Params

RequestParams creates an httprequest.Params object from the given fields.

func URL

func URL(prefix, path, dischargeID string) string

URL creates a URL addressed to the given path within the IDP handler and adds the given dischargeID (when specified).

Types

type RegistrationParams

type RegistrationParams struct {
	// State contains some opaque state for the registration. It can
	// be used to pass arbitrary data back to the idp once the
	// registration is processed.
	State string

	// Username contains the preferred username for the user. This
	// will be used to populate the username input.
	Username string

	// Error contains an error message if the registration failed.
	Error string

	// Domain contains the domain in which the user is being created.
	// This cannot be modified by the user.
	Domain string

	// FullName contains the full name of the user. This is used to
	// populate the fullname input.
	FullName string

	// Email contains the email address of the user. This is used to
	// populate the email input.
	Email string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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