Skip to content

Commit

Permalink
Merge pull request #7 from mittelab/master
Browse files Browse the repository at this point in the history
Handle the state parameter in callback URL.
  • Loading branch information
splitbrain committed Apr 21, 2023
2 parents fde2b1b + 82cf301 commit 28a7ade
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Generic.php
Expand Up @@ -10,6 +10,11 @@
*/
class Generic extends AbstractOAuth2Base
{
/** @inheritdoc */
public function needsStateParameterInAuthUrl() {
$plugin = plugin_load('helper', 'oauthgeneric');
return 0 !== $plugin->getConf('needs-state');
}

/** @inheritdoc */
public function getAuthorizationEndpoint()
Expand Down
1 change: 1 addition & 0 deletions conf/default.php
Expand Up @@ -11,6 +11,7 @@
$conf['userurl'] = '';
$conf['authmethod'] = 0;
$conf['scopes'] = '';
$conf['needs-state'] = 0;

$conf['json-user'] = '';
$conf['json-name'] = '';
Expand Down
1 change: 1 addition & 0 deletions conf/metadata.php
Expand Up @@ -11,6 +11,7 @@
$meta['userurl'] = array('string');
$meta['authmethod'] = array('multichoice', '_choices' => [0, 1, 6, 2, 3, 4, 5]);
$meta['scopes'] = array('array');
$meta['needs-state'] = array('onoff');

$meta['json-user'] = array('string');
$meta['json-name'] = array('string');
Expand Down
2 changes: 1 addition & 1 deletion lang/cs/settings.php
Expand Up @@ -11,8 +11,8 @@
$lang['tokenurl'] = 'URL pro získání tokenu';
$lang['userurl'] = 'Relativní URL pro získání uživatelských informací z API (musí vracet JSON data autentizovaného uživatele)';
$lang['authmethod'] = 'Autorizační metoda pro získání uživatelských informací z API';
$lang['scopes'] = 'Scopes to request (comma separated)';
$lang['scopes'] = 'Požadovaná oprávnění (scopes, oddělená čárkou)';
$lang['needs-state'] = 'Poskytovatel potřebuje a poskytuje parametr pro přesměrování na callback URL';

$lang['json-user'] = 'Objektová cesta k uživatelskému jménu (tečková notace)';
$lang['json-name'] = 'Objektová cesta k celému jménu uživatele (tečkovánotace)';
Expand Down
1 change: 1 addition & 0 deletions lang/en/settings.php
Expand Up @@ -12,6 +12,7 @@
$lang['userurl'] = 'URL to the user info API endpoint (must return JSON about the authenticated user)';
$lang['authmethod'] = 'Authorization method used when talking to the user API';
$lang['scopes'] = 'Scopes to request (comma separated)';
$lang['needs-state'] = 'The provider needs and supplies a state parameter in the callback URL.';

$lang['json-user'] = 'Access to the username in dot notation';
$lang['json-name'] = 'Access to the full name in dot notation';
Expand Down

0 comments on commit 28a7ade

Please sign in to comment.