Skip to content
Snippets Groups Projects
Commit 881d61ac authored by Dominik František Bučík's avatar Dominik František Bučík
Browse files

chore: merge branch 'fix_psr' into 'main'

style: :lipstick: fix PSR complains

See merge request perun-proxy-aai/simplesamlphp/simplesamlphp-module-perunauthorize!17
parents d5b6746d 513fbac8
Branches
Tags
1 merge request!17style: 💄 fix PSR complains
Pipeline #296758 passed with warnings
......@@ -19,15 +19,14 @@ use SimpleSAML\Locale\Translate;
*/
class Perunauthorize extends ProcessingFilter
{
const DENY = 'deny';
const REGEX = 'regex';
const SERVICE_NAME_PLACEHOLDER = '%SERVICE_NAME%';
const SERVICE_EMAIL_PLACEHOLDER = '%SERVICE_EMAIL%';
const SP_METADATA = 'SPMetadata';
const ADMINISTRATION_CONTACT = 'administrationContact';
const MESSAGE = 'message';
const NAME = 'name';
public const DENY = 'deny';
public const REGEX = 'regex';
public const SERVICE_NAME_PLACEHOLDER = '%SERVICE_NAME%';
public const SERVICE_EMAIL_PLACEHOLDER = '%SERVICE_EMAIL%';
public const SP_METADATA = 'SPMetadata';
public const ADMINISTRATION_CONTACT = 'administrationContact';
public const MESSAGE = 'message';
public const NAME = 'name';
/**
* Flag to deny/unauthorize the user a attribute filter IS found
......
<?php
namespace lib;
class TemplateHelper
{
public function getBaseURL($t, $type = 'get', $key = null, $value = null): string
{
if (isset($t->data['informationURL'])) {
$vars = [
'informationURL' => $t->data['informationURL'],
'administrationContact' => $t->data['administrationContact'],
'serviceName' => $t->data['serviceName'],
];
} else {
$vars = [
'administrationContact' => $t->data['administrationContact'],
'serviceName' => $t->data['serviceName'],
];
}
if (isset($key)) {
if (isset($vars[$key])) {
unset($vars[$key]);
}
if (isset($value)) {
$vars[$key] = $value;
}
}
if ($type === 'get') {
return 'perunauthorize_403.php?' . http_build_query($vars, '', '&amp;');
}
$text = '';
foreach ($vars as $k => $v) {
$text .= '<input type="hidden" name="' . $k . '" value="' . htmlspecialchars($v) . '" />' . PHP_EOL;
}
return $text;
}
}
<script>
// When the user clicks on <div>, open the popup
function myFunction() {
var popup = document.getElementById('myPopup');
popup.classList.toggle('show');
}
</script>
<?php
/**
......@@ -25,45 +17,18 @@ $this->data['403_subject'] = $this->t('{perunauthorize:Perunauthorize:403_subjec
$this->data['403_informationPage'] = $this->t('{perunauthorize:Perunauthorize:403_informationPage}');
$this->data['403_contactSupport'] = $this->t('{perunauthorize:Perunauthorize:403_contactSupport}');
function getBaseURL($t, $type = 'get', $key = null, $value = null)
{
if (isset($t->data['informationURL'])) {
$vars = [
'informationURL' => $t->data['informationURL'],
'administrationContact' => $t->data['administrationContact'],
'serviceName' => $t->data['serviceName'],
];
} else {
$vars = [
'administrationContact' => $t->data['administrationContact'],
'serviceName' => $t->data['serviceName'],
];
}
if (isset($key)) {
if (isset($vars[$key])) {
unset($vars[$key]);
}
if (isset($value)) {
$vars[$key] = $value;
}
}
if ($type === 'get') {
return 'perunauthorize_403.php?' . http_build_query($vars, '', '&amp;');
}
$text = '';
foreach ($vars as $k => $v) {
$text .= '<input type="hidden" name="' . $k . '" value="' . htmlspecialchars($v) . '" />' . PHP_EOL;
}
return $text;
}
$this->includeAtTemplateBase('includes/header.php');
?>
<script>
// When the user clicks on <div>, open the popup
function myFunction() {
var popup = document.getElementById('myPopup');
popup.classList.toggle('show');
}
</script>
<style>
.error_message {
word-wrap: break-word;
......
<?php
use SimpleSAML\Error\BadRequest;
use SimpleSAML\Auth\State;
use SimpleSAML\Configuration;
use SimpleSAML\XHTML\Template;
/**
* Show a 403 Forbidden page about not authorized to access an application.
*
* @package SimpleSAMLphp
*/
use SimpleSAML\Error\BadRequest;
use SimpleSAML\Auth\State;
use SimpleSAML\Configuration;
use SimpleSAML\XHTML\Template;
if (!array_key_exists('StateId', $_REQUEST)) {
throw new BadRequest('Missing required StateId query parameter.');
}
......@@ -20,12 +20,12 @@ $state = State::loadState($_REQUEST['StateId'], 'perunauthorize:Perunauthorize')
$globalConfig = Configuration::getInstance();
$t = new Template($globalConfig, 'perunauthorize:perunauthorize_403.php');
header('HTTP/1.0 403 Forbidden');
if (isset($_REQUEST['informationURL'])) {
$t->data['informationURL'] = $_REQUEST['informationURL'];
}
header('HTTP/1.0 403 Forbidden');
$t->data['administrationContact'] = $_REQUEST['administrationContact'];
$t->data['serviceName'] = $_REQUEST['serviceName'];
$t->show();
<?php
use SimpleSAML\Error\BadRequest;
use SimpleSAML\Auth\State;
use SimpleSAML\Configuration;
use SimpleSAML\XHTML\Template;
/**
* Show a 403 Forbidden page about not authorized to access an application.
*
* @package SimpleSAMLphp
*/
use SimpleSAML\Error\BadRequest;
use SimpleSAML\Auth\State;
use SimpleSAML\Configuration;
use SimpleSAML\XHTML\Template;
if (!array_key_exists('StateId', $_REQUEST)) {
throw new BadRequest('Missing required StateId query parameter.');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment