Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIv1 ¶
APIv1 holds all the information that we want to be available for all the functions in the API, things like our logging, metrics, and other telemetry.
func (APIv1) Server ¶
Server returns an http.Handler that will handle all the requests for v1 of the API. The baseURL should be set to whatever prefix the muxer matches to pass requests to the Handler; consider it the root path of v1 of the API.
func (APIv1) VerifyRequest ¶
VerifyRequest calculates the HMAC signature of `r` and compares it to the passed Authorization header, while also checking the claimed SHA256 hash of the content matches the body of the request. It either returns the body of the request, or a Response indicating the error in the request. If Response is not nil, it is meant to be returned, short-circuiting the request. If Response is nil, the returned string can safely be assumed to be an authenticated request body.
type Change ¶
type Change struct {
UserPolicy *string `json:"userPolicy"`
UserExceptions *[]string `json:"userExceptions"`
ClientPolicy *string `json:"clientPolicy"`
ClientExceptions *[]string `json:"clientExceptions"`
IsDefault *bool `json:"isDefault"`
}
Change is the API representation of a Change. It dictates what the JSON representation of Changes will be.
type Response ¶
type Response struct {
Scopes []Scope `json:"scopes,omitempty"`
Errors []api.RequestError `json:"errors,omitempty"`
Status int `json:"-"`
}
Response is used to encode JSON responses; it is the global response format for all API responses.
type Scope ¶
type Scope struct {
ID string `json:"id"`
UserPolicy string `json:"userPolicy"`
UserExceptions []string `json:"userExceptions"`
ClientPolicy string `json:"clientPolicy"`
ClientExceptions []string `json:"clientExceptions"`
IsDefault bool `json:"isDefault"`
}
Scope is the API representation of an Scope. it dictates what the JSON representation of Scopes will be.