[5.x] OAuth: option not to create or update user during authentication #10853
+90
−9
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.
Problem
When implementing oAuth authentication, non-existent users are created (as unauthorized users).
I understand why that is. Normally, in applications, the user logs in with oAuth and registers directly. But I don't need this feature in the CMS administration.
We have corporate oAuth authentication, through which we authenticate in all corporate applications, and I don't want to have hundreds of unauthorized users in the "users" section of Statamic.
Solution
I suggest extending the statamic.oauth configuration option to disable/enable automatic user creation and update.
Usage
Just add config options to the
config/statamic/oauth.php
:In case of unauthorized user there is the option to change redirect URL:
Back compatibility
As you see in the
src/Http/Controllers/OAuthController.php
, default configuration values do not change the behavior of the current version. So the user will be created and his data will be merged.