0.1.x-dev
0.1.9999999.9999999-devAPI Key management for SilverStripe
BSD-3-Clause
The Requires
by Sam Minnee
API Key management for SilverStripe
This module provides a way of creating an managing API keys within SilverStripe. This can be useful for building RESTful and other APIs., (*2)
composer require sminnee/silverstripe-apikey
SecurityAdmin
provide interfaces for seeing API keys, and generating new ones. API keys are
allocated member-by-member.RequestMiddleware
will look for an API key header (default: X-API-Key
) and if it is present, authenticate the
user so that Member::currentUser() will return the corresponding member. This should be configured by non-GraphQL
requests.ApiKeyAuthenticator
should be configured for GraphQL
request and will return the authenticated member for GraphQL contexts to use, while not applying it to the CMS
session.For regular module usage, use the RequestMiddleware
class. The configuration to apply it is in this module's apikey.yml
,
but is commented out., (*3)
Copy the configuration and add it to your mysite/_config/apikey.yml
file., (*4)
This will protect all of your frontend routes., (*5)
The GraphQL authenticator will work separately from the RequestMiddleware
. If using this module for GraphQL, you will
probably want to disable the RequestMiddleware
. If you run both at the same time you will find that:, (*6)
This should be considered experimental for now, and used with care. It has not received a security audit., (*7)
API Key management for SilverStripe
BSD-3-Clause