diff --git a/Generic.php b/Generic.php index 706bddae7f9288cf6ec6583f67320a44952401c4..fb0ef7616a638343143f0eb8880448cbcc2a8678 100644 --- a/Generic.php +++ b/Generic.php @@ -10,6 +10,11 @@ use OAuth\Common\Http\Uri\Uri; */ class Generic extends AbstractOAuth2Base { + /** @inheritdoc */ + public function needsStateParameterInAuthUrl() { + $plugin = plugin_load('helper', 'oauthgeneric'); + return 0 !== $plugin->getConf('needs-state'); + } /** @inheritdoc */ public function getAuthorizationEndpoint() diff --git a/conf/default.php b/conf/default.php index b8278712fe487d5f0924da7b365dbd64ebb0a23f..46826158b80263a3302397823a54f84da2799d06 100644 --- a/conf/default.php +++ b/conf/default.php @@ -11,6 +11,7 @@ $conf['tokenurl'] = ''; $conf['userurl'] = ''; $conf['authmethod'] = 0; $conf['scopes'] = ''; +$conf['needs-state'] = 0; $conf['json-user'] = ''; $conf['json-name'] = ''; diff --git a/conf/metadata.php b/conf/metadata.php index 59cac6eb2a9ab4ed7272082527750470b55c7984..c227540866024a8ef2de8066df1e6ebef53f5063 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -11,6 +11,7 @@ $meta['tokenurl'] = array('string'); $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'); diff --git a/lang/cs/settings.php b/lang/cs/settings.php index e5f5510697c83eb69926f2cc10f651c291b4b7ac..cea5838cdbe3ea427eda7919ab66e005b4bbd057 100644 --- a/lang/cs/settings.php +++ b/lang/cs/settings.php @@ -11,8 +11,8 @@ $lang['authurl'] = 'URL pro autentizaci'; $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)'; diff --git a/lang/en/settings.php b/lang/en/settings.php index 12e3dd86e06fcd586ebf7badcf1de040b858cc53..33ef4d6cfce19a458e0384a5c5715553f8e11528 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -12,6 +12,7 @@ $lang['tokenurl'] = 'URL to the token endpoint'; $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';