Skip to content

Commit

Permalink
a few adjustments
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Dec 13, 2023
1 parent cff1aff commit 9918c41
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public function singleLogoutService() {
$discoveryData = $this->discoveryService->obtainDiscovery($provider);
$defaultEndSessionEndpoint = $discoveryData['end_session_endpoint'];
$customEndSessionEndpoint = $provider->getEndSessionEndpoint();
$endSessionEndpoint = $customEndSessionEndpoint ?? $defaultEndSessionEndpoint;
$endSessionEndpoint = $customEndSessionEndpoint ?: $defaultEndSessionEndpoint;

if ($endSessionEndpoint) {
$endSessionEndpoint .= '?post_logout_redirect_uri=' . $targetUrl;
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function __construct(
$this->crypto = $crypto;
}

public function createProvider(string $identifier, string $clientId, string $clientSecret, string $discoveryEndpoint, string $endSessionEndpoint,
array $settings = [], string $scope = 'openid email profile'): JSONResponse {
public function createProvider(string $identifier, string $clientId, string $clientSecret, string $discoveryEndpoint,
array $settings = [], string $scope = 'openid email profile', ?string $endSessionEndpoint = null): JSONResponse {
if ($this->providerService->getProviderByIdentifier($identifier) !== null) {
return new JSONResponse(['message' => 'Provider with the given identifier already exists'], Http::STATUS_CONFLICT);
}
Expand Down
14 changes: 10 additions & 4 deletions lib/Db/ProviderMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@

namespace OCA\UserOIDC\Db;

use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\AppFramework\Db\QBMapper;
use OCP\DB\Exception;
use OCP\IDBConnection;

use OCP\AppFramework\Db\DoesNotExistException;
Expand Down Expand Up @@ -88,13 +91,16 @@ public function getProviders() {
/**
* Create or update provider settings
*
* @param string identifier
* @param string $identifier
* @param string|null $clientid
* @param string|null $clientsecret
* @param string|null $discoveryuri
* @param string scope
* @throws \OCP\AppFramework\Db\DoesNotExistException
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @param string $scope
* @param string|null $endsessionendpointuri
* @return Provider|Entity
* @throws DoesNotExistException
* @throws MultipleObjectsReturnedException
* @throws Exception
*/
public function createOrUpdateProvider(string $identifier, string $clientid = null,
string $clientsecret = null, string $discoveryuri = null, string $scope = 'openid email profile',
Expand Down
3 changes: 2 additions & 1 deletion src/components/SettingsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@
required>
</p>
<p>
<label for="oidc-end-session-endpoint">{{ t('user_oidc', 'End session endpoint') }}</label>
<label for="oidc-end-session-endpoint">{{ t('user_oidc', 'Custom end session endpoint') }}</label>
<input id="oidc-end-session-endpoint"
v-model="localProvider.endSessionEndpoint"
class="italic-placeholder"
type="text"
maxlength="255"
placeholder="(Optional)">
</p>
<p>
Expand Down

0 comments on commit 9918c41

Please sign in to comment.