Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@
require_once __DIR__ . '/../../vendor/autoload.php';

class Application extends App implements IBootstrap {
public const APP_ID = 'user_saml';

public function __construct(array $urlParams = []) {
parent::__construct('user_saml', $urlParams);
parent::__construct(self::APP_ID, $urlParams);
}

public function register(IRegistrationContext $context): void {
Expand Down Expand Up @@ -95,7 +97,7 @@ public function boot(IBootContext $context): void {
$params = [];

// Setting up the one login config may fail, if so, do not catch the requests later.
switch ($config->getAppValue('user_saml', 'type')) {
switch ($config->getAppValue(self::APP_ID, 'type')) {
case 'saml':
$type = 'saml';
break;
Expand All @@ -116,11 +118,11 @@ public function boot(IBootContext $context): void {
try {
OC_User::handleApacheAuth();
} catch (LoginException $e) {
if ($request->getPathInfo() === '/apps/user_saml/saml/error') {
if ($request->getPathInfo() === '/apps/' . self::APP_ID . '/saml/error') {
return;
}
$targetUrl = $urlGenerator->linkToRouteAbsolute(
'user_saml.SAML.genericError',
self::APP_ID . '.SAML.genericError',
[
'message' => $e->getMessage()
]
Expand All @@ -136,11 +138,11 @@ public function boot(IBootContext $context): void {
if ($user !== null) {
$enabled = $user->isEnabled();
if ($enabled === false) {
if ($request->getPathInfo() === '/apps/user_saml/saml/error') {
if ($request->getPathInfo() === '/apps/' . self::APP_ID . '/saml/error') {
return;
}
$targetUrl = $urlGenerator->linkToRouteAbsolute(
'user_saml.SAML.genericError',
self::APP_ID . '.SAML.genericError',
[
'message' => $l10n->t('This user account is disabled, please contact your administrator.')
]
Expand Down Expand Up @@ -182,7 +184,7 @@ public function boot(IBootContext $context): void {
}

$targetUrl = $urlGenerator->linkToRouteAbsolute(
'user_saml.SAML.selectUserBackEnd',
self::APP_ID . '.SAML.selectUserBackEnd',
[
'redirectUrl' => $redirectUrl
]
Expand All @@ -204,7 +206,7 @@ public function boot(IBootContext $context): void {

$csrfToken = $csrfTokenManager->getToken();
$targetUrl = $urlGenerator->linkToRouteAbsolute(
'user_saml.SAML.login',
self::APP_ID . '.SAML.login',
[
'requesttoken' => $csrfToken->getEncryptedValue(),
'originalUrl' => $originalUrl,
Expand All @@ -216,7 +218,7 @@ public function boot(IBootContext $context): void {
}
});
} catch (Throwable $e) {
Server::get(LoggerInterface::class)->critical('Error when loading user_saml app', [
Server::get(LoggerInterface::class)->critical('Error when loading ' . self::APP_ID . ' app', [
'exception' => $e,
]);
}
Expand Down
6 changes: 1 addition & 5 deletions lib/Command/ConfigGet.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@

protected function execute(InputInterface $input, OutputInterface $output): int {
$providerId = (int)$input->getOption('providerId');
if (!empty($providerId)) {
$providerIds = [$providerId];
} else {
$providerIds = array_keys($this->samlSettings->getListOfIdps());
}
$providerIds = !empty($providerId) ? [$providerId] : array_keys($this->samlSettings->getListOfIdps();

Check failure on line 38 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable28

ParseError

lib/Command/ConfigGet.php:38:103: ParseError: Syntax error, unexpected ';', expecting ')' on line 38 (see https://psalm.dev/173)

Check failure on line 38 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable29

ParseError

lib/Command/ConfigGet.php:38:103: ParseError: Syntax error, unexpected ';', expecting ')' on line 38 (see https://psalm.dev/173)

Check failure on line 38 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable31

ParseError

lib/Command/ConfigGet.php:38:103: ParseError: Syntax error, unexpected ';', expecting ')' on line 38 (see https://psalm.dev/173)

Check failure on line 38 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

ParseError

lib/Command/ConfigGet.php:38:103: ParseError: Syntax error, unexpected ';', expecting ')' on line 38 (see https://psalm.dev/173)

Check failure on line 38 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

ParseError

lib/Command/ConfigGet.php:38:103: ParseError: Syntax error, unexpected ';', expecting ')' on line 38 (see https://psalm.dev/173)

$settings = [];
foreach ($providerIds as $pid) {

Check failure on line 41 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable28

UndefinedVariable

lib/Command/ConfigGet.php:41:12: UndefinedVariable: Cannot find referenced variable $providerIds (see https://psalm.dev/024)

Check failure on line 41 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable29

UndefinedVariable

lib/Command/ConfigGet.php:41:12: UndefinedVariable: Cannot find referenced variable $providerIds (see https://psalm.dev/024)

Check failure on line 41 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable31

UndefinedVariable

lib/Command/ConfigGet.php:41:12: UndefinedVariable: Cannot find referenced variable $providerIds (see https://psalm.dev/024)

Check failure on line 41 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

UndefinedVariable

lib/Command/ConfigGet.php:41:12: UndefinedVariable: Cannot find referenced variable $providerIds (see https://psalm.dev/024)

Check failure on line 41 in lib/Command/ConfigGet.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

UndefinedVariable

lib/Command/ConfigGet.php:41:12: UndefinedVariable: Cannot find referenced variable $providerIds (see https://psalm.dev/024)
$settings[$pid] = $this->samlSettings->get($pid);
}

Expand Down
Loading