loginserver

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package loginserver implements a "terraform login protocol" server:

https://developer.hashicorp.com/terraform/internals/v1.3.x/login-protocol#client

Index

Constants

View Source
const (
	ErrInvalidRequest          string = "invalid_request"
	ErrInvalidGrant            string = "invalid_grant"
	ErrInvalidClient           string = "invalid_client"
	ErrUnsupportedGrantType    string = "unsupported_grant_type"
	ErrUnsupportedResponseType string = "unsupported_response_type"
	ErrAccessDenied            string = "access_denied"
	ErrServerError             string = "server_error"
)

https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1

View Source
const (
	// OAuth2 client ID - purely advisory according to:
	// https://developer.hashicorp.com/terraform/internals/v1.3.x/login-protocol#client
	ClientID = "terraform"

	AuthRoute  = "/app/oauth2/auth"
	TokenRoute = "/oauth2/token"
)

Variables

View Source
var Discovery = DiscoverySpec{
	Client:     ClientID,
	GrantTypes: []string{"authz_code"},
	Authz:      AuthRoute,
	Token:      TokenRoute,
	Ports:      []int{10000, 10010},
}

Functions

func NewServer

func NewServer(opts Options) *server

Types

type DiscoverySpec

type DiscoverySpec struct {
	Client     string   `json:"client"`
	GrantTypes []string `json:"grant_types"`
	Authz      string   `json:"authz"`
	Token      string   `json:"token"`
	Ports      []int    `json:"ports"`
}

type Options

type Options struct {
	Secret      []byte // for encrypting auth code
	UserService *user.Service

	html.Renderer
}

Options for server constructor

Jump to

Keyboard shortcuts

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