Documentation
¶
Overview ¶
Package apikeys handles generating, revoking, and listing data on api keys. API keys are used for authenticating automated access to this app.
Only certain endpoints are accessible via an API key, not all of this app's functionality is accessible via an outside integration. The limitations are for security purposes and because not all functionality needs to be accessible via a public API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNonPublicEndpoint = errors.New("api: access denied to non-public endpoint")
ErrNonPublicEndpoint is returned when a request is made via an api key to an endpoint that isn't in the list publicEndpoints.
Functions ¶
func Generate ¶
func Generate(w http.ResponseWriter, r *http.Request)
Generate creates a new API key and saves it to the database.
func GetAll ¶
func GetAll(w http.ResponseWriter, r *http.Request)
GetAll looks up a list of all API keys. This is used on the manage API keys page.
func IsPublicEndpoint ¶
IsPublicEndpoint checks if a provided URL is in the list of publically accessible endpoints. If not, it returnes an error.
An error is returned, instead of just a bool, so that we can reply with the error to the request. This prevents us from just returning some generic error.
Types ¶
This section is empty.