authserver

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 {
	TestingT *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(req 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(req 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