Possible to set space seperated scopes in the settings

This commit is contained in:
Felix Gustavsson 2017-04-16 17:55:51 +02:00
parent 96b8b17612
commit b6713cf0dc
2 changed files with 16 additions and 1 deletions

View File

@ -106,7 +106,7 @@ class GenericOAuth2Provider extends Base implements OAuthAuthenticationProviderI
$this->helper->url->to('OAuthController', 'handler', array('plugin' => 'OAuth2'), '', true),
$this->getOAuthAuthorizeUrl(),
$this->getOAuthTokenUrl(),
array()
$this->getScopes()
);
}
@ -160,6 +160,18 @@ class GenericOAuth2Provider extends Base implements OAuthAuthenticationProviderI
return $this->configModel->get('oauth2_client_id');
}
/**
* Get scopes
*
* @access public
* @return array
*/
public function getScopes()
{
return explode(" ", $this->configModel->get('oauth2_scopes'));
}
/**
* Get client secret
*

View File

@ -18,6 +18,9 @@
<?= $this->form->label(t('User API URL'), 'oauth2_user_api_url') ?>
<?= $this->form->text('oauth2_user_api_url', $values) ?>
<?= $this->form->label(t('Scopes'), 'oauth2_scopes') ?>
<?= $this->form->text('oauth2_scopes', $values) ?>
<?= $this->form->label(t('Username Key'), 'oauth2_key_username') ?>
<?= $this->form->text('oauth2_key_username', $values) ?>