rest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const ADMIN_USER = "admin"
View Source
const SERVER_TYPE_OBSERVABILITY = "observability"
View Source
const SERVER_TYPE_VPN = "vpn"
View Source
const SETUP_CODE_FILE = "setup-code.txt"
View Source
const UPGRADESERVER_URI = "127.0.0.1:8081"

Variables

View Source
var (
	TLSWaiterCompleted bool
)

Functions

func IsAdminMiddleware

func IsAdminMiddleware(next http.Handler) http.Handler

func SaveConfig

func SaveConfig(c *Context) error

func StartServer

func StartServer(httpPort, httpsPort int, serverType string, storage storage.Iface, c *Context, assets fs.FS)

Types

type AppClient

type AppClient interface {
	GetRouter() *http.ServeMux
}

type Apps

type Apps struct {
	Clients map[string]AppClient `json:"clients,omitempty"`
}

type AuthMethodsProvider

type AuthMethodsProvider struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	RedirectURI string `json:"redirectURI,omitempty"`
}

type AuthMethodsResponse

type AuthMethodsResponse struct {
	LocalAuthDisabled bool                  `json:"localAuthDisabled"`
	OIDCProviders     []AuthMethodsProvider `json:"oidcProviders"`
}

type Context

type Context struct {
	AppDir                  string               `json:"appDir,omitempty"`
	ServerType              string               `json:"serverType,omitempty"`
	SetupCompleted          bool                 `json:"setupCompleted"`
	Hostname                string               `json:"hostname,omitempty"`
	Protocol                string               `json:"protocol,omitempty"`
	JWTKeys                 *JWTKeys             `json:"jwtKeys,omitempty"`
	JWTKeysKID              string               `json:"jwtKeysKid,omitempty"`
	OIDCProviders           []oidc.OIDCProvider  `json:"oidcProviders,omitempty"`
	LocalAuthDisabled       bool                 `json:"disableLocalAuth,omitempty"`
	EnableTLS               bool                 `json:"enableTLS,omitempty"`
	RedirectToHttps         bool                 `json:"redirectToHttps,omitempty"`
	EnableOIDCTokenRenewal  bool                 `json:"enableOIDCTokenRenewal,omitempty"`
	OIDCStore               *oidcstore.Store     `json:"oidcStore,omitempty"`
	UserStore               *users.UserStore     `json:"users,omitempty"`
	OIDCRenewal             *oidcrenewal.Renewal `json:"oidcRenewal,omitempty"`
	LoginAttempts           login.Attempts       `json:"loginAttempts,omitempty"`
	LicenseUserCount        int                  `json:"licenseUserCount,omitempty"`
	CloudType               string               `json:"cloudType,omitempty"`
	TokenRenewalTimeMinutes int                  `json:"tokenRenewalTimeMinutes,omitempty"`
	LogLevel                int                  `json:"loglevel,omitempty"`
	SCIM                    *SCIM                `json:"scim,omitempty"`
	SAML                    *SAML                `json:"saml,omitempty"`
	Apps                    *Apps                `json:"apps,omitempty"`
	Storage                 *Storage             `json:"storage,omitempty"`
}

func GetConfig

func GetConfig(storage storage.Iface) (*Context, error)

func NewContext

func NewContext(storage storage.Iface, serverType string, userStore *users.UserStore, scimInstance scim.Iface, licenseUserCount int, cloudType string, apps map[string]AppClient) (*Context, error)

func (*Context) GetUserFromRequest

func (c *Context) GetUserFromRequest(r *http.Request) (users.User, error)

func (*Context) ReloadConfig

func (c *Context) ReloadConfig()

type ContextRequest

type ContextRequest struct {
	Secret        string `json:"secret"`
	TagHash       string `json:"tagHash"`
	InstanceID    string `json:"instanceID"`
	AdminPassword string `json:"adminPassword"`
	Hostname      string `json:"hostname"`
	Protocol      string `json:"protocol"`
}

type ContextSetupResponse

type ContextSetupResponse struct {
	SetupCompleted bool   `json:"setupCompleted"`
	CloudType      string `json:"cloudType"`
	ServerType     string `json:"serverType"`
}

type CustomValue

type CustomValue string

type FactorRequest

type FactorRequest struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Secret string `json:"secret"`
	Code   string `json:"code"`
}

type GeneralSetupRequest

type GeneralSetupRequest struct {
	Hostname               string `json:"hostname"`
	EnableTLS              bool   `json:"enableTLS"`
	RedirectToHttps        bool   `json:"redirectToHttps"`
	DisableLocalAuth       bool   `json:"disableLocalAuth"`
	EnableOIDCTokenRenewal bool   `json:"enableOIDCTokenRenewal"`
}

type JWTKeys

type JWTKeys struct {
	PrivateKey *rsa.PrivateKey `json:"privateKey,omitempty"`
	PublicKey  *rsa.PublicKey  `json:"publicKey,omitempty"`
}

type JwtHeader

type JwtHeader struct {
	Alg string `json:"alg"`
	Typ string `json:"typ"`
	Kid string `json:"kid"`
}

type LicenseResponse

type LicenseResponse struct {
	LicenseUserCount int    `json:"licenseUserCount"`
	CurrentUserCount int    `json:"currentUserCount,omitempty"`
	CloudType        string `json:"cloudType"`
	Key              string `json:"key,omitempty"`
}

type NewUserRequest

type NewUserRequest struct {
	Login    string `json:"login"`
	Role     string `json:"role"`
	Password string `json:"password,omitempty"`
}

type OIDCCallback

type OIDCCallback struct {
	Code        string `json:"code"`
	State       string `json:"state"`
	RedirectURI string `json:"redirectURI"`
}

type SAML

type SAML struct {
	Providers *[]saml.Provider `json:"providers"`
	Client    saml.Iface       `json:"client,omitempty"`
}

type SAMLCallback

type SAMLCallback struct {
	Code        string `json:"code"`
	RedirectURI string `json:"redirectURI"`
}

type SAMLSetup

type SAMLSetup struct {
	Enabled        bool   `json:"enabled"`
	MetadataURL    string `json:"metadataURL,omitempty"`
	RegenerateCert bool   `json:"regenerateCert,omitempty"`
}

type SCIM

type SCIM struct {
	EnableSCIM bool       `json:"enableSCIM,omitempty"`
	Token      string     `json:"token"`
	Client     scim.Iface `json:"client,omitempty"`
}

type SCIMSetup

type SCIMSetup struct {
	Enabled         bool   `json:"enabled"`
	Token           string `json:"token,omitempty"`
	RegenerateToken bool   `json:"regenerateToken,omitempty"`
	BaseURL         string `json:"baseURL,omitempty"`
}

type Storage

type Storage struct {
	Client storage.Iface `json:"client,omitempty"`
}

type UserInfoResponse

type UserInfoResponse struct {
	Login    string `json:"login"`
	Role     string `json:"role"`
	UserType string `json:"userType"`
}

type UsersResponse

type UsersResponse struct {
	ID                               string    `json:"id"`
	Login                            string    `json:"login"`
	Role                             string    `json:"role"`
	OIDCID                           string    `json:"oidcID"`
	SAMLID                           string    `json:"samlID"`
	Provisioned                      bool      `json:"provisioned"`
	Suspended                        bool      `json:"suspended"`
	ConnectionsDisabledOnAuthFailure bool      `json:"connectionsDisabledOnAuthFailure"`
	LastTokenRenewal                 time.Time `json:"lastTokenRenewal,omitempty"`
	LastLogin                        string    `json:"lastLogin"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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