config

package
v0.0.0-...-69f8e6d Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Overview

Package config provides the config details for the services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUser

func AddUser(rawText string) error

func GenerateAccountKey

func GenerateAccountKey(c *Config, s *Service, a *Account) (string, error)

func GenerateAuthUrl

func GenerateAuthUrl(oauthConf *oauth2.Config) (string, string, error)

func GenerateOauthConfig

func GenerateOauthConfig(url string, s *Service) (*oauth2.Config, error)

func RemoveAccount

func RemoveAccount(i int, s int) error

func RemoveService

func RemoveService(i int) error

func RemoveUser

func RemoveUser(rawText string) error

func SetEndpointUrl

func SetEndpointUrl(rawText string) error

func VerifyState

func VerifyState(code string, state string) (string, error)

Types

type Account

type Account struct {
	AccountName       string // name for this account
	ServiceURL        string // service endpoint to be connected
	OauthAccountCreds *oauth2.Token
	ClientCreds       *ClientCreds
}

Account stores the account name and the credential details for connections to/from the web-api-gateway.

type AccountUpdater

type AccountUpdater struct {
	S int
	C *Config
	// contains filtered or unexported fields
}

func NewAccountUpdater

func NewAccountUpdater(previousName string, s int) (*AccountUpdater, error)

func (*AccountUpdater) ClientCreds

func (u *AccountUpdater) ClientCreds() error

func (*AccountUpdater) Commit

func (u *AccountUpdater) Commit() (interface{}, error)

func (*AccountUpdater) Name

func (u *AccountUpdater) Name(name string) error

func (*AccountUpdater) OauthCreds

func (u *AccountUpdater) OauthCreds(code string) error

func (*AccountUpdater) ServiceURL

func (u *AccountUpdater) ServiceURL(serviceURL string) error

type ClientCreds

type ClientCreds struct {
	Protocol   string // rule for encrypting messages
	PrivateKey string // key for encrypting messages
}

ClientCreds stores the autorization details to connect to this account.

type Config

type Config struct {
	Url      string
	Users    map[string]bool
	Services []*Service
	Template Template
}

Config is the root for configuration of the web-api-gateway.

func ReadConfig

func ReadConfig() (*Config, error)

func ReadWriteConfig

func ReadWriteConfig() (c *Config, save func() error, err error)

type Domain

type Domain struct {
	DomainName string
	ServiceURL string
}

type Engine

type Engine struct {
	EngineName string
	AuthURL    string
	TokenURL   string
	Scopes     string
	Domains    []*Domain
}

type OauthServiceCreds

type OauthServiceCreds struct {
	ClientID     string   // public identifier
	ClientSecret string   // secret identifier
	AuthURL      string   // authenticaiton endpoint
	TokenURL     string   // token request endpoint
	Scopes       []string // scopes of the requests
}

OauthServiceCreds stores the information to get authorized to connect new accounts.

type Service

type Service struct {
	ServiceName       string // name for reference when setting up an account
	OauthServiceCreds *OauthServiceCreds
	Accounts          []*Account
	EngineName        string
}

Service represents a distinct endpoint that can contain multiple account.

type ServiceUpdater

type ServiceUpdater struct {
	// contains filtered or unexported fields
}

func NewServiceUpdater

func NewServiceUpdater(previousName string) (*ServiceUpdater, error)

func (*ServiceUpdater) AuthURL

func (u *ServiceUpdater) AuthURL(authURL string) error

func (*ServiceUpdater) ClientID

func (u *ServiceUpdater) ClientID(clientID string) error

func (*ServiceUpdater) ClientSecret

func (u *ServiceUpdater) ClientSecret(clientSecret string) error

func (*ServiceUpdater) Commit

func (u *ServiceUpdater) Commit() (interface{}, error)

func (*ServiceUpdater) EngineName

func (u *ServiceUpdater) EngineName(engineName string) error

func (*ServiceUpdater) Name

func (u *ServiceUpdater) Name(name string) error

func (*ServiceUpdater) Scopes

func (u *ServiceUpdater) Scopes(scopes string) error

func (*ServiceUpdater) TokenURL

func (u *ServiceUpdater) TokenURL(tokenURL string) error

type Template

type Template struct {
	Engines []*Engine
}

func ReadTemplate

func ReadTemplate() (*Template, error)

Jump to

Keyboard shortcuts

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