mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Use simple oauth static scope provider by default
This commit is contained in:
parent
4b54e4ddac
commit
7b8beddd9e
3 changed files with 20 additions and 0 deletions
|
@ -9,4 +9,5 @@ dependencies:
|
||||||
- jsonapi_extras:jsonapi_extras
|
- jsonapi_extras:jsonapi_extras
|
||||||
- jsonapi_schema:jsonapi_schema
|
- jsonapi_schema:jsonapi_schema
|
||||||
- simple_oauth:simple_oauth
|
- simple_oauth:simple_oauth
|
||||||
|
- simple_oauth:simple_oauth_static_scope
|
||||||
- subrequests:subrequests
|
- subrequests:subrequests
|
||||||
|
|
|
@ -26,6 +26,9 @@ function farm_api_install() {
|
||||||
$simple_oauth_settings->set('public_key', '../keys/public.key');
|
$simple_oauth_settings->set('public_key', '../keys/public.key');
|
||||||
$simple_oauth_settings->set('private_key', '../keys/private.key');
|
$simple_oauth_settings->set('private_key', '../keys/private.key');
|
||||||
|
|
||||||
|
// Use static scopes by default.
|
||||||
|
$simple_oauth_settings->set('scope_provider', 'static');
|
||||||
|
|
||||||
// Save simple_oauth settings.
|
// Save simple_oauth settings.
|
||||||
$simple_oauth_settings->save();
|
$simple_oauth_settings->save();
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,19 @@ function farm_api_post_update_remove_consumer_fields(&$sandbox = NULL) {
|
||||||
$entity_definition_update_manager->uninstallFieldStorageDefinition($roles_field_definition);
|
$entity_definition_update_manager->uninstallFieldStorageDefinition($roles_field_definition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable static oauth2 scopes.
|
||||||
|
*/
|
||||||
|
function farm_api_post_update_enable_static_oauth2_scopes(&$sandbox = NULL) {
|
||||||
|
|
||||||
|
// Enable static scope module.
|
||||||
|
if (!\Drupal::service('module_handler')->moduleExists('simple_oauth_static_scope')) {
|
||||||
|
\Drupal::service('module_installer')->install(['simple_oauth_static_scope']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use static scope provider.
|
||||||
|
$simple_oauth_settings = \Drupal::configFactory()->getEditable('simple_oauth.settings');
|
||||||
|
$simple_oauth_settings->set('scope_provider', 'static');
|
||||||
|
$simple_oauth_settings->save();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue