Documentation ¶
Overview ¶
Package handlers defines handlers for all of the endpoints accessible from the core server.
Index ¶
- Variables
- func Playground(title string, endpoint string) http.HandlerFunc
- type Auth
- func (a *Auth) AllowOriginFunc(origin string) bool
- func (a *Auth) AuthorizePluginToken(ctx context.Context) error
- func (a *Auth) GetRegisteredPlugins() map[string]PluginInfo
- func (a *Auth) Handler(next http.Handler) http.Handler
- func (a *Auth) RefreshConfig() error
- func (a *Auth) WebsocketInitFunc(ctx context.Context, payload transport.InitPayload) (context.Context, error)
- type InitPayloadGetter
- type MapHandler
- type PluginInfo
Constants ¶
This section is empty.
Variables ¶
var ErrAuth = errors.New(
"unauthorized error: the request lacks valid authentication credentials for the target resource",
)
Functions ¶
func Playground ¶
func Playground(title string, endpoint string) http.HandlerFunc
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth provides a middleware handler that handles cross-origin requests and pulling of authentication from incoming requests. It also handles the registration and deregistration of plugins and updates its authorizer methods accordingly.
func NewAuth ¶
NewAuth creates a new instance of Auth. InitPayloadGetter provides a way to grab credentials from the context when the connection is made via Websockets.
func (*Auth) AllowOriginFunc ¶
AllowOriginFunc returns true only if the origin is referenced by any URL of the registered plugins.
func (*Auth) AuthorizePluginToken ¶
AuthorizePluginToken checks to make sure that the provided plugin token is valid and is authorized to make plugin-level requests.
func (*Auth) GetRegisteredPlugins ¶
func (a *Auth) GetRegisteredPlugins() map[string]PluginInfo
GetRegisteredPlugins returns a copy of the map containing all the plugins and their API tokens.
func (*Auth) Handler ¶
Handler returns a handler that serves cross-origin requests and pulls authentication data from incoming requests.
func (*Auth) RefreshConfig ¶
RefreshConfig will read the configuration from the config provider and add and remove plugins as necessary. Any preexisting plugins will retain the same ID and apiToken
func (*Auth) WebsocketInitFunc ¶
type InitPayloadGetter ¶
type InitPayloadGetter func(context.Context) transport.InitPayload
InitPayloadGetter provides an alternate method of retrieving credentials for when the token cannot be sent via HTTP headers (basically the case of websockets)
type MapHandler ¶
type MapHandler struct {
// contains filtered or unexported fields
}
MapHandler serves requests for map images. It will attempt to serve them from disk first, downloading from xivapi if necessary. Users are subject to Client IP based rate limiting.
Usage: GET /maps/{map_id} -> Returns an image with content type image/png or image/jpg Example: GET /maps/123 -> 200 OK, image/png GET /maps/1234 -> 404 Not Found
func (*MapHandler) ServeHTTP ¶
func (h *MapHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves maps for the handler