core

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentType     = "Content-Type"
	ApplicationJSON = "application/json"
	TextHTML        = "text/html"
	TextPlain       = "text/plain"
	ApplicationJWT  = "application/jwt"
)

http headers

Variables

This section is empty.

Functions

func ShortKey

func ShortKey(s string) string

ShortKey returns the first 12 characters of a public key (or the key if it is < 12 long)

func UnescapedIndentedMarshal

func UnescapedIndentedMarshal(v interface{}, prefix, indent string) ([]byte, error)

UnescapedIndentedMarshal handle indention for decoded JWTs

func UnixToDate

func UnixToDate(d int64) string

UnixToDate parses a unix date in UTC to a time

Types

type AccountServer

type AccountServer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

AccountServer is the core structure for the server.

func NewAccountServer

func NewAccountServer() *AccountServer

NewAccountServer creates a new account server with a default logger

func (*AccountServer) ApplyConfigFile

func (server *AccountServer) ApplyConfigFile(configFile string) error

ApplyConfigFile applies the config file to the server's config

func (*AccountServer) GetAccountJWT

func (server *AccountServer) GetAccountJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)

GetAccountJWT looks up an account JWT by public key and returns it Supports cache control

func (*AccountServer) GetActivationJWT

func (server *AccountServer) GetActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)

GetActivationJWT looks for an activation token by hash

func (*AccountServer) GetOperatorJWT

func (server *AccountServer) GetOperatorJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)

GetOperatorJWT returns the known operator JWT

func (*AccountServer) HealthZ added in v0.8.2

func (server *AccountServer) HealthZ(w http.ResponseWriter, r *http.Request, params httprouter.Params)

HealthZ returns a status OK

func (*AccountServer) InitializeFromConfig

func (server *AccountServer) InitializeFromConfig(config *conf.AccountServerConfig) error

InitializeFromConfig initialize the server's configuration to an existing config object, useful for tests Does not change the config at all, use DefaultServerConfig() to create a default config

func (*AccountServer) InitializeFromFlags

func (server *AccountServer) InitializeFromFlags(flags Flags) error

InitializeFromFlags is called from main to configure the server, the server will decide what needs to happen based on the flags. On reload the same flags are passed

func (*AccountServer) JWTHelp

func (server *AccountServer) JWTHelp(w http.ResponseWriter, r *http.Request, params httprouter.Params)

JWTHelp handles get requests for JWT help

func (*AccountServer) Logger

func (server *AccountServer) Logger() logging.Logger

Logger hosts a shared logger

func (*AccountServer) PackJWTs added in v0.8.2

func (server *AccountServer) PackJWTs(w http.ResponseWriter, r *http.Request, params httprouter.Params)

PackJWTs the JWTS and return takes a parameter for max

func (*AccountServer) Start

func (server *AccountServer) Start() error

Start the server, will lock the server, assumes the config is loaded

func (*AccountServer) Stop

func (server *AccountServer) Stop()

Stop the account server

func (*AccountServer) UpdateAccountJWT

func (server *AccountServer) UpdateAccountJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)

UpdateAccountJWT is the target of the post request that updates an account JWT Sends a nats notification

func (*AccountServer) UpdateActivationJWT

func (server *AccountServer) UpdateActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)

UpdateActivationJWT is the handler for POST requests that update an activation JWT

type Flags

type Flags struct {
	ConfigFile string

	NSCFolder string

	Directory string

	ReadOnly bool

	NATSURL string
	Creds   string

	Debug           bool
	Verbose         bool
	DebugAndVerbose bool

	HostPort string

	Primary string
}

Flags defines the various flags you can call the account server with. These are used in main and passed down to the server code to process.

Jump to

Keyboard shortcuts

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