Skip to content

Commit

Permalink
fix: re-enable PKCE by default
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Ly <[email protected]>
  • Loading branch information
edward-ly committed Oct 6, 2024
1 parent a3f3fb5 commit 73d606d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ sudo -u www-data php var/www/nextcloud/occ config:app:set --value=0 user_oidc al

This app supports PKCE (Proof Key for Code Exchange).
https://datatracker.ietf.org/doc/html/rfc7636
It is disabled by default and can be enabled in `config.php`:
It is enabled by default, but can be disabled in `config.php`:
``` php
'user_oidc' => [
'use_pkce' => true,
'use_pkce' => false,
],
```

Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function login(int $providerId, ?string $redirectUrl = null) {
$this->session->set(self::NONCE, $nonce);

$oidcSystemConfig = $this->config->getSystemValue('user_oidc', []);
$isPkceEnabled = isset($oidcSystemConfig['use_pkce']) && $oidcSystemConfig['use_pkce'];
$isPkceEnabled = $oidcSystemConfig['use_pkce'] ?? true;
if ($isPkceEnabled) {
// PKCE code_challenge see https://datatracker.ietf.org/doc/html/rfc7636
$code_verifier = $this->random->generate(128, ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER);
Expand Down Expand Up @@ -396,7 +396,7 @@ public function code(string $state = '', string $code = '', string $scope = '',
}

$oidcSystemConfig = $this->config->getSystemValue('user_oidc', []);
$isPkceEnabled = isset($oidcSystemConfig['use_pkce']) && $oidcSystemConfig['use_pkce'];
$isPkceEnabled = $oidcSystemConfig['use_pkce'] ?? true;

$discovery = $this->discoveryService->obtainDiscovery($provider);

Expand Down

0 comments on commit 73d606d

Please sign in to comment.