authserver

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package authserver provides a stub server of the OAuth 2.0 authorization server. This supports the authorization code grant described as: https://tools.ietf.org/html/rfc6749#section-4.1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationRequest

type AuthorizationRequest struct {
	Scope       string
	State       string
	RedirectURI string
	Raw         url.Values
}

AuthorizationRequest represents an authorization request described as: https://tools.ietf.org/html/rfc6749#section-4.1.1

type Handler

type Handler struct {
	T *testing.T

	// This should return a URL with query parameters of authorization response.
	// See https://tools.ietf.org/html/rfc6749#section-4.1.2
	NewAuthorizationResponse func(r AuthorizationRequest) string

	// This should return a JSON body of access token response or error response.
	// See https://tools.ietf.org/html/rfc6749#section-5.1
	// and https://tools.ietf.org/html/rfc6749#section-5.2
	NewTokenResponse func(r TokenRequest) (int, string)
}

Handler handles HTTP requests.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TokenRequest

type TokenRequest struct {
	Code string
	Raw  url.Values
}

TokenRequest represents a token request described as: https://tools.ietf.org/html/rfc6749#section-4.1.3

Jump to

Keyboard shortcuts

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