Documentation ¶
Index ¶
- Constants
- func ShortKey(s string) string
- func UnescapedIndentedMarshal(v interface{}, prefix, indent string) ([]byte, error)
- func UnixToDate(d int64) string
- type AccountServer
- func (server *AccountServer) ApplyConfigFile(configFile string) error
- func (server *AccountServer) GetAccountJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (server *AccountServer) GetActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (server *AccountServer) GetOperatorJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (server *AccountServer) HealthZ(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (server *AccountServer) InitializeFromConfig(config *conf.AccountServerConfig) error
- func (server *AccountServer) InitializeFromFlags(flags Flags) error
- func (server *AccountServer) JWTHelp(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (server *AccountServer) Logger() logging.Logger
- func (server *AccountServer) PackJWTs(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (server *AccountServer) Start() error
- func (server *AccountServer) Stop()
- func (server *AccountServer) UpdateAccountJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (server *AccountServer) UpdateActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- type Flags
Constants ¶
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 ¶
ShortKey returns the first 12 characters of a public key (or the key if it is < 12 long)
func UnescapedIndentedMarshal ¶
UnescapedIndentedMarshal handle indention for decoded JWTs
Types ¶
type AccountServer ¶
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) 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.