authx - Accept API keys by default #20081
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This slightly relaxes the default settings so that it is easier to use
authx
as a replacement forextern/rest.php
(whichuses the
api_key
for authentication).Before
extern/rest.php
acceptsapi_key
s.authx
can acceptapi_key
s, but you have to change some settings to allow it.After
Both
extern/rest.php
andauthx
acceptapi_key
s by default.Comments
The defaults in authx were designed to be a bit paranoid. The basic goal -- don't let anyone open up access accidentally. However, the current protections are a bit of overkill. Suppose you're setting up an API key for use with
civicrm/ajax/*
. Here are the sysadmin tasks:civicrm_contact.api_key
). (Doing this requiresedit api keys
oredit own api keys
.)authx
(It's inert otherwise.)authenticate via api key
, or convey theSITE_KEY
to the user, or disable allauthx_guards
authx_header_cred
orauthx_xheader_cred
orauthx_param_cred
to allowapi_key
Notably, the default in
#4
was chosen during earlier drafting... beforeauthx_guards
existed. But now we have the guards, and we have even more steps to go through.This change relaxes the defaults so that step
#4
is not necessary. This arrangement is still fairly paranoid (ie we still have 1+2+3). Compared toextern/rest.php
, there's still an extra opt-in hoop.