Documentation ¶
Index ¶
- Constants
- func NewNilLogger() natsserver.Logger
- func Run(server *AccountServer) error
- func ShortKey(s string) string
- func UnixToDate(d int64) string
- type AccountServer
- func (server *AccountServer) ApplyConfigFile(configFile string) error
- func (server *AccountServer) Config() *conf.AccountServerConfig
- func (server *AccountServer) ConfigureLogger() natsserver.Logger
- func (server *AccountServer) InitializeFromConfig(config *conf.AccountServerConfig) error
- func (server *AccountServer) InitializeFromFlags(flags Flags) error
- func (server *AccountServer) LoadAcc(publicKey string) (string, error)
- func (server *AccountServer) LoadAct(hash string) (string, error)
- func (server *AccountServer) Logger() natsserver.Logger
- func (server *AccountServer) Merge(pack string) error
- func (server *AccountServer) Pack(maxJWTs int) (string, error)
- func (server *AccountServer) ReadyForConnections(dur time.Duration) bool
- func (server *AccountServer) SaveAct(hash string, theJWT string) error
- func (server *AccountServer) Start() error
- func (server *AccountServer) Stop()
- type Flags
- type JwtHandler
- func (h *JwtHandler) GetAccountJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (h *JwtHandler) GetActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (h *JwtHandler) GetOperatorJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (h *JwtHandler) InitRouter(r *httprouter.Router)
- func (h *JwtHandler) Initialize(opJWT []byte, sysAccJWT []byte, jwtStore store.JWTStore, packLimit int, ...) error
- func (h *JwtHandler) JWTHelp(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (h *JwtHandler) PackJWTs(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (h *JwtHandler) UpdateAccountJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- func (h *JwtHandler) UpdateActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
- type NilLogger
- func (l *NilLogger) Debugf(format string, v ...interface{})
- func (l *NilLogger) Errorf(format string, v ...interface{})
- func (l *NilLogger) Fatalf(format string, v ...interface{})
- func (l *NilLogger) Noticef(format string, v ...interface{})
- func (l *NilLogger) Tracef(format string, v ...interface{})
- func (l *NilLogger) Warnf(format string, v ...interface{})
Constants ¶
const ( ContentType = "Content-Type" ApplicationJSON = "application/json" TextHTML = "text/html" TextPlain = "text/plain" ApplicationJWT = "application/jwt" )
http headers
const NscError = `support for direct access of the nsc folder has been removed` + commonErr
const RoError = `support for read only directory access with file system updates has been removed` + commonErr
Variables ¶
This section is empty.
Functions ¶
func NewNilLogger ¶ added in v1.0.0
func NewNilLogger() natsserver.Logger
func Run ¶ added in v1.0.0
func Run(server *AccountServer) error
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) Config ¶ added in v1.0.1
func (server *AccountServer) Config() *conf.AccountServerConfig
func (*AccountServer) ConfigureLogger ¶ added in v1.0.0
func (server *AccountServer) ConfigureLogger() natsserver.Logger
ConfigureLogger configures the logger for this account server
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) LoadAcc ¶ added in v1.0.0
func (server *AccountServer) LoadAcc(publicKey string) (string, error)
Wrap store with a nats layer, so lookups can be forwarded
func (*AccountServer) LoadAct ¶ added in v1.0.0
func (server *AccountServer) LoadAct(hash string) (string, error)
func (*AccountServer) Logger ¶
func (server *AccountServer) Logger() natsserver.Logger
Logger hosts a shared logger
func (*AccountServer) Merge ¶ added in v1.0.0
func (server *AccountServer) Merge(pack string) error
func (*AccountServer) Pack ¶ added in v1.0.0
func (server *AccountServer) Pack(maxJWTs int) (string, error)
func (*AccountServer) ReadyForConnections ¶ added in v1.0.0
func (server *AccountServer) ReadyForConnections(dur time.Duration) bool
func (*AccountServer) SaveAct ¶ added in v1.0.0
func (server *AccountServer) SaveAct(hash string, theJWT string) error
func (*AccountServer) Start ¶
func (server *AccountServer) Start() error
Start the server, will lock the server, assumes the config is loaded
type Flags ¶
type Flags struct { ConfigFile string Directory string OperatorJWTPath string NATSURL string Creds string Debug bool Verbose bool DebugAndVerbose bool HostPort string Primary string // Only used to copy jwt from old account server }
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.
type JwtHandler ¶ added in v1.0.0
type JwtHandler struct {
// contains filtered or unexported fields
}
func NewJwtHandler ¶ added in v1.0.0
func NewJwtHandler(logger natsserver.Logger) JwtHandler
func (*JwtHandler) GetAccountJWT ¶ added in v1.0.0
func (h *JwtHandler) 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 (*JwtHandler) GetActivationJWT ¶ added in v1.0.0
func (h *JwtHandler) GetActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
GetActivationJWT looks for an activation token by hash
func (*JwtHandler) GetOperatorJWT ¶ added in v1.0.0
func (h *JwtHandler) GetOperatorJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
GetOperatorJWT returns the known operator JWT
func (*JwtHandler) InitRouter ¶ added in v1.0.0
func (h *JwtHandler) InitRouter(r *httprouter.Router)
BuildRouter initializes the http.Router with default router setup
func (*JwtHandler) Initialize ¶ added in v1.0.0
func (h *JwtHandler) Initialize(opJWT []byte, sysAccJWT []byte, jwtStore store.JWTStore, packLimit int, accNotification accountNotification, actNotification activationNotification, sign accountSignup) error
Initialize JwtHandler which exposes http handler on top of a jwtStore To Close, stop using the jwthandler and close the passed in store.
func (*JwtHandler) JWTHelp ¶ added in v1.0.0
func (h *JwtHandler) JWTHelp(w http.ResponseWriter, r *http.Request, params httprouter.Params)
JWTHelp handles get requests for JWT help
func (*JwtHandler) PackJWTs ¶ added in v1.0.0
func (h *JwtHandler) PackJWTs(w http.ResponseWriter, r *http.Request, params httprouter.Params)
PackJWTs the JWTS and return takes a parameter for max
func (*JwtHandler) UpdateAccountJWT ¶ added in v1.0.0
func (h *JwtHandler) 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 (*JwtHandler) UpdateActivationJWT ¶ added in v1.0.0
func (h *JwtHandler) UpdateActivationJWT(w http.ResponseWriter, r *http.Request, params httprouter.Params)
UpdateActivationJWT is the handler for POST requests that update an activation JWT