api

package
v0.0.0-...-58d6594 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Port         string
	VaultAddr    string
	VaultToken   string
	LdapHost     string
	LdapAdmin    string
	LdapPassword string
	Localhost    bool
}

API : Service configuration

func New

func New(port string) *API

New : Server setup

func (API) Authenticate

func (api API) Authenticate(w http.ResponseWriter, r *http.Request, p httprouter.Params)

Authenticate : authenticate directly with ldap

func (API) Authenticate2

func (api API) Authenticate2(w http.ResponseWriter, r *http.Request, p httprouter.Params)

Authenticate2 : authenticate the username/pass

func (API) Run

func (api API) Run()

Run : Launch the thing

type User

type User struct {
	Username   string `json:"username"`
	Customerno string `json:"customerno"`
	Message    string `json:"message"`
	Success    bool   `json:"success"`
	Error      error  `json:"error"`
}

User : The user data to be returned to the application

type VaultData

type VaultData struct {
	Data struct {
		Customerno string `json:"customerno"`
		Password   string `json:"password"`
		Username   string `json:"username"`
	} `json:"data"`
	Metadata struct {
		CreatedTime  time.Time `json:"created_time"`
		DeletionTime string    `json:"deletion_time"`
		Destroyed    bool      `json:"destroyed"`
		Version      int       `json:"version"`
	} `json:"metadata"`
}

VaultData : makes json payload usable

Jump to

Keyboard shortcuts

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