mirror of
https://github.com/netzbegruenung/user_saml.git
synced 2024-05-04 18:13:41 +02:00
cs:fix
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
6ed78c3c02
commit
4510f70ff7
|
@ -185,7 +185,6 @@ if ($redirectSituation === true && $showLoginOptions) {
|
|||
);
|
||||
header('Location: '.$targetUrl);
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
if ($redirectSituation === true) {
|
||||
|
|
|
@ -28,7 +28,7 @@ use OCP\AppFramework\IAppContainer;
|
|||
use OCP\SabrePluginEvent;
|
||||
|
||||
class Application extends App {
|
||||
public function __construct(array $urlParams = array()) {
|
||||
public function __construct(array $urlParams = []) {
|
||||
parent::__construct('user_saml', $urlParams);
|
||||
$container = $this->getContainer();
|
||||
|
||||
|
@ -57,7 +57,6 @@ class Application extends App {
|
|||
}
|
||||
|
||||
public function registerDavAuth() {
|
||||
|
||||
$container = $this->getContainer();
|
||||
|
||||
$dispatcher = $container->getServer()->getEventDispatcher();
|
||||
|
|
|
@ -38,8 +38,6 @@ use OCP\ILogger;
|
|||
use OCP\IRequest;
|
||||
use OCP\ISession;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Security\ICrypto;
|
||||
use OneLogin\Saml2\Auth;
|
||||
|
@ -295,7 +293,6 @@ class SAMLController extends Controller {
|
|||
$this->session->set(ClientFlowLoginV2Controller::TOKEN_NAME, $data['flow']['cf2']['token']);
|
||||
$this->session->set(ClientFlowLoginV2Controller::STATE_NAME, $data['flow']['cf2']['state']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$AuthNRequestID = $data['AuthNRequestID'];
|
||||
|
@ -401,7 +398,7 @@ class SAMLController extends Controller {
|
|||
if ($isFromIDP) {
|
||||
// requests comes from the IDP so let it manage the logout
|
||||
// (or raise Error if request is invalid)
|
||||
$pass = True ;
|
||||
$pass = true ;
|
||||
} elseif ($isFromGS) {
|
||||
// Request is from master GlobalScale
|
||||
// Request validity is check via a JSON Web Token
|
||||
|
@ -435,7 +432,7 @@ class SAMLController extends Controller {
|
|||
}
|
||||
} else {
|
||||
// If request is not from IDP, we send the logout request to the IDP
|
||||
$parameters = array();
|
||||
$parameters = [];
|
||||
$nameId = $this->session->get('user_saml.samlNameId');
|
||||
$nameIdFormat = $this->session->get('user_saml.samlNameIdFormat');
|
||||
$nameIdNameQualifier = $this->session->get('user_saml.samlNameIdNameQualifier');
|
||||
|
@ -491,7 +488,6 @@ class SAMLController extends Controller {
|
|||
* @return Http\TemplateResponse
|
||||
*/
|
||||
public function selectUserBackEnd($redirectUrl) {
|
||||
|
||||
$attributes = ['loginUrls' => []];
|
||||
|
||||
if ($this->SAMLSettings->allowMultipleUserBackEnds()) {
|
||||
|
@ -543,7 +539,6 @@ class SAMLController extends Controller {
|
|||
* @return string
|
||||
*/
|
||||
private function getSSOUrl($redirectUrl, $idp) {
|
||||
|
||||
$originalUrl = '';
|
||||
if (!empty($redirectUrl)) {
|
||||
$originalUrl = $this->urlGenerator->getAbsoluteURL($redirectUrl);
|
||||
|
@ -561,7 +556,6 @@ class SAMLController extends Controller {
|
|||
);
|
||||
|
||||
return $ssoUrl;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -612,5 +606,4 @@ class SAMLController extends Controller {
|
|||
$message = $this->l->t('This page should not be visited directly.');
|
||||
return new Http\TemplateResponse($this->appName, 'error', ['message' => $message], 'guest');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,5 +116,4 @@ class SettingsController extends Controller {
|
|||
}
|
||||
return new Response();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
|
||||
|
|
|
@ -24,11 +24,8 @@ namespace OCA\User_SAML;
|
|||
use OCA\DAV\Connector\Sabre\Auth;
|
||||
use OCP\IConfig;
|
||||
use OCP\ISession;
|
||||
use Sabre\DAV\CorePlugin;
|
||||
use Sabre\DAV\FS\Directory;
|
||||
use Sabre\DAV\Server;
|
||||
use Sabre\DAV\ServerPlugin;
|
||||
use Sabre\DAV\Tree;
|
||||
use Sabre\HTTP\RequestInterface;
|
||||
use Sabre\HTTP\ResponseInterface;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace OCA\User_SAML\Middleware;
|
||||
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\Http\RedirectResponse;
|
||||
use OCP\AppFramework\Middleware;
|
||||
use OCP\AppFramework\Utility\IControllerMethodReflector;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace OCA\User_SAML;
|
||||
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
use OCP\ISession;
|
||||
|
@ -99,7 +98,6 @@ class SAMLSettings {
|
|||
* @return array
|
||||
*/
|
||||
public function getOneLoginSettingsArray($idp) {
|
||||
|
||||
$prefix = '';
|
||||
if ($idp > 1) {
|
||||
$prefix = $idp . '-';
|
||||
|
@ -179,7 +177,6 @@ class SAMLSettings {
|
|||
* @return string
|
||||
*/
|
||||
public function getPrefix($setting = '') {
|
||||
|
||||
$prefix = '';
|
||||
if (!empty($setting) && in_array($setting, $this->globalSettings)) {
|
||||
return $prefix;
|
||||
|
@ -192,5 +189,4 @@ class SAMLSettings {
|
|||
|
||||
return $prefix;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -226,5 +226,4 @@ class Admin implements ISettings {
|
|||
public function getPriority() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ use OCP\IConfig;
|
|||
use OCP\IURLGenerator;
|
||||
use OCP\ISession;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
use function base64_decode;
|
||||
|
||||
class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
||||
/** @var IConfig */
|
||||
|
@ -108,7 +107,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
* @param string $uid
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function createUserIfNotExists($uid, array $attributes = array()) {
|
||||
public function createUserIfNotExists($uid, array $attributes = []) {
|
||||
if (!$this->userExistsInDatabase($uid)) {
|
||||
$values = [
|
||||
'uid' => $uid,
|
||||
|
@ -144,7 +143,6 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
$qb->execute();
|
||||
|
||||
$this->initializeHomeDir($uid);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,8 +543,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
self::$backends = $backends;
|
||||
}
|
||||
|
||||
private function getAttributeKeys($name)
|
||||
{
|
||||
private function getAttributeKeys($name) {
|
||||
$prefix = $this->settings->getPrefix($name);
|
||||
$keys = explode(' ', $this->config->getAppValue('user_saml', $prefix . $name, ''));
|
||||
|
||||
|
@ -584,7 +581,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
private function getAttributeArrayValue($name, array $attributes) {
|
||||
$keys = $this->getAttributeKeys($name);
|
||||
|
||||
$value = array();
|
||||
$value = [];
|
||||
foreach ($keys as $key) {
|
||||
if (isset($attributes[$key])) {
|
||||
if (is_array($attributes[$key])) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
|
|
|
@ -111,7 +111,9 @@ style('user_saml', 'admin');
|
|||
name="name-id-format">
|
||||
<?php foreach ($_['name-id-formats'] as $key => $value): ?>
|
||||
<option value="<?php p($key) ?>"
|
||||
<?php if ($value['selected'] ?? false) { p("selected"); } ?> ><?php p($value['label']) ?></option>
|
||||
<?php if ($value['selected'] ?? false) {
|
||||
p("selected");
|
||||
} ?> ><?php p($value['label']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php foreach ($_['sp'] as $key => $text): ?>
|
||||
|
|
|
@ -45,8 +45,6 @@ class FeatureContext implements Context {
|
|||
'track_redirects' => true,
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** @AfterScenario */
|
||||
|
@ -135,7 +133,7 @@ class FeatureContext implements Context {
|
|||
];
|
||||
|
||||
// Remove everything after a comma in the URL since cookies are passed there
|
||||
list($url['path'])=explode(';', $url['path']);
|
||||
[$url['path']] = explode(';', $url['path']);
|
||||
|
||||
foreach ($paramsToCheck as $param) {
|
||||
if ($targetUrl[$param] !== $url[$param]) {
|
||||
|
@ -184,7 +182,6 @@ class FeatureContext implements Context {
|
|||
foreach ($inputElements as $node) {
|
||||
$postData[$node->getAttribute('name')] = $node->getAttribute('value');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->response = $this->client->request(
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
namespace OCA\User_SAML\Tests\AppInfo;
|
||||
|
||||
use OCA\User_SAML\AppInfo\Application;
|
||||
use OCA\User_SAML\Controller\SAMLController;
|
||||
use OCA\User_SAML\Middleware\OnlyLoggedInMiddleware;
|
||||
|
||||
class ApplicationTest extends \Test\TestCase {
|
||||
|
@ -49,7 +48,6 @@ class ApplicationTest extends \Test\TestCase {
|
|||
return [
|
||||
['OnlyLoggedInMiddleware', OnlyLoggedInMiddleware::class],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,6 @@ use OCP\IRequest;
|
|||
use OCP\ISession;
|
||||
use OCP\IURLGenerator;
|
||||
|
||||
|
||||
class GetMetadataTest extends \Test\TestCase {
|
||||
|
||||
/** @var GetMetadata|\PHPUnit_Framework_MockObject_MockObject*/
|
||||
|
|
|
@ -112,7 +112,6 @@ class SAMLControllerTest extends TestCase {
|
|||
$this->userData,
|
||||
$this->crypto
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function testLoginWithInvalidAppValue() {
|
||||
|
|
|
@ -24,7 +24,6 @@ namespace OCA\User_SAML\Tests\Middleware;
|
|||
use Exception;
|
||||
use OCA\User_SAML\Middleware\OnlyLoggedInMiddleware;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\Http\RedirectResponse;
|
||||
use OCP\AppFramework\Utility\IControllerMethodReflector;
|
||||
use OCP\IURLGenerator;
|
||||
|
|
|
@ -55,7 +55,7 @@ class AdminTest extends \Test\TestCase {
|
|||
$this->l10n
|
||||
->expects($this->any())
|
||||
->method('t')
|
||||
->will($this->returnCallback(function($text, $parameters = array()) {
|
||||
->will($this->returnCallback(function ($text, $parameters = []) {
|
||||
return vsprintf($text, $parameters);
|
||||
}));
|
||||
|
||||
|
|
|
@ -307,5 +307,4 @@ class UserBackendTest extends TestCase {
|
|||
->with('ExistingUser', 'New Displayname');
|
||||
$this->userBackend->updateAttributes('ExistingUser', ['email' => 'new@example.com', 'displayname' => 'New Displayname', 'quota' => '']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
|
|
Loading…
Reference in a new issue