backend

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package backend provides the Vault plugin backend that is used to generate authentication keys for Tailscale devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, config *logical.BackendConfig) (logical.Backend, error)

Create a new logical.Backend implementation that can generate authentication keys for Tailscale devices.

Types

type Backend

type Backend struct {
	*framework.Backend
}

The Backend type is responsible for handling inbound requests from Vault to serve Tailscale authentication keys.

func (*Backend) GenerateKey

func (b *Backend) GenerateKey(ctx context.Context, request *logical.Request, data *framework.FieldData) (*logical.Response, error)

GenerateKey generates a new authentication key via the Tailscale API. This method checks the existing Backend configuration for the Tailnet and API key. It will return an error if the configuration does not exist.

func (*Backend) ReadConfiguration

func (b *Backend) ReadConfiguration(ctx context.Context, request *logical.Request, _ *framework.FieldData) (*logical.Response, error)

ReadConfiguration reads the Backend configuration and returns its values.

func (*Backend) UpdateConfiguration

func (b *Backend) UpdateConfiguration(ctx context.Context, request *logical.Request, data *framework.FieldData) (*logical.Response, error)

UpdateConfiguration modifies the Backend configuration. Returns an error if any required fields are missing.

type Config

type Config struct {
	Tailnet string `json:"tailnet"`
	APIKey  string `json:"api_key"`
	APIUrl  string `json:"api_url"`
}

The Config type describes the configuration fields used by the Backend

Jump to

Keyboard shortcuts

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