Skip to content

Commit 5b35ab7

Browse files
ioigoumetvdijenpradtke
authored
SSP-2066_add_routes_and_controllers (#45)
* Move validate.php to symfony controller * Fix quality errors * Loggout Controller * LoggedOut Controller * Fix quality issues * composer require checker for dev environments * fix composer require checker version * Add tests for LogoutController.php part1 * psalm * LogoutController.php tests part 2 * add CAS10 validate.php tests * Add missing dependency * LoggedInController.php * Cas10 validate improvements * serviceValidate, proxyValidate, logoutController * samlValidate.php controller and tests * fix psalm errors * move proxy.php to Cas20Controller action * Removed cas.php.Added LoginController.php * UrlTrait tests * Add missing import * LoginController Tests * Tests for Cas20 validate * add tests for Proxy Service Validate * More tests on Cas20Controller.php * Use TicketStore abstract class type * Use Module::resolveClass * Use RunnableResponse instead of redirect * Added phpdocs * Fix run with docker instructions * xml response to UTF-8 * Fix validation condition for CAS10 * review fixes #1 * Intantiate classes after we finalize the casconfig overrides. Refactor checkServiceUrl.Improve composer validate. * fix UrlTrait::validate to handle proxy tickets * fix UrlTrait::validate call test for the different methods. * user RunnableResponse * preg_match better error handling * Use DOMDocumentFactory instead of ext-xml to parse the SOAP message * Refactor samlValidate, parsing postbody. * Improve saml validate * Improve samlValidate. Use saml11 1,2,4 * Move Cas20 validate function to TicketValidatorTrait * Create an enum list of configuration options that are allowed to be overriden. * Add missing enum file * fix saml11 versioning in composer * minor fixes * Remove PDO as a hard dependency. It's optional when using SQLTicketStore * Add more hints for running with docker * Allow `attributes` config item to be set per SP * Add missing trait dependency * Fix debug mode validation response rendering * Exclude public directory from lint and documentation checks * Remove js libraries * Add copy button and missing jquery dependency package * Replace text with langauge key * Remove unnecessary package --------- Co-authored-by: Tim van Dijen <[email protected]> Co-authored-by: Patrick Radtke <[email protected]>
1 parent 81b6b53 commit 5b35ab7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3987
-1716
lines changed

.github/workflows/documentation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ jobs:
2626
with:
2727
files: .
2828
ignore_path: .markdownlintignore
29+
ignore_files: public/**
2930

3031
- name: Perform spell check
3132
uses: codespell-project/actions-codespell@v2
3233
with:
3334
path: '**/*.md'
3435
check_filenames: true
36+
skip: public/**
3537
ignore_words_list: tekst
3638

3739
build:

.github/workflows/php.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
VALIDATE_YAML: true
3838
VALIDATE_XML: true
3939
VALIDATE_GITHUB_ACTIONS: true
40+
FILTER_REGEX_EXCLUDE: 'public/**'
4041

4142
quality:
4243
name: Quality control

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,20 @@ To explore the module using docker run the below command. This will run an SSP i
8888
of the `casserver` module mounted in the container, along with some configuration files. Any code changes you make to your git checkout are
8989
"live" in the container, allowing you to test and iterate different things.
9090

91+
Sometimes when working with a dev version of the module you will need a newer version of a dependency than what SSP is
92+
locked to. In that case you can add an additional dependency to the `COMPOSER_REQUIRE` line (e.g ="simplesamlphp/assert:1.8 ")
93+
9194
```bash
92-
# Note: this currently errors on this module requiring a newer version of `simplesamlphp/xml-common` than what is in the base image
9395
docker run --name ssp-casserver-dev \
9496
--mount type=bind,source="$(pwd)",target=/var/simplesamlphp/staging-modules/casserver,readonly \
9597
-e STAGINGCOMPOSERREPOS=casserver \
96-
-e COMPOSER_REQUIRE="simplesamlphp/simplesamlphp-module-casserver:@dev simplesamlphp/simplesamlphp-module-preprodwarning"
98+
-e COMPOSER_REQUIRE="simplesamlphp/simplesamlphp-module-casserver:@dev simplesamlphp/simplesamlphp-module-preprodwarning" \
9799
-e SSP_ADMIN_PASSWORD=secret1 \
98100
--mount type=bind,source="$(pwd)/docker/ssp/module_casserver.php",target=/var/simplesamlphp/config/module_casserver.php,readonly \
99101
--mount type=bind,source="$(pwd)/docker/ssp/authsources.php",target=/var/simplesamlphp/config/authsources.php,readonly \
100102
--mount type=bind,source="$(pwd)/docker/ssp/config-override.php",target=/var/simplesamlphp/config/config-override.php,readonly \
101103
--mount type=bind,source="$(pwd)/docker/apache-override.cf",target=/etc/apache2/sites-enabled/ssp-override.cf,readonly \
102-
-p 443:443 cirrusid/simplesamlphp:v2.3.2
104+
-p 443:443 cirrusid/simplesamlphp:v2.3.5
103105
```
104106

105107
Visit [https://localhost/simplesaml/](https://localhost/simplesaml/) and confirm you get the default page.

composer.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,48 @@
3030
},
3131
"require": {
3232
"php": "^8.1",
33-
"ext-ctype": "*",
3433
"ext-dom": "*",
3534
"ext-filter": "*",
3635
"ext-libxml": "*",
3736
"ext-SimpleXML": "*",
37+
"ext-session": "*",
38+
3839
"simplesamlphp/assert": "^1.1",
3940
"simplesamlphp/composer-module-installer": "^1.3",
40-
"simplesamlphp/simplesamlphp": "^2.2",
41-
"simplesamlphp/xml-cas": "^v1.3",
42-
"simplesamlphp/xml-common": "^v1.17",
43-
"simplesamlphp/xml-soap": "^v1.5"
41+
"simplesamlphp/simplesamlphp": "^2.3",
42+
"simplesamlphp/xml-cas": "^1.3",
43+
"simplesamlphp/xml-common": "^1.17",
44+
"simplesamlphp/xml-soap": "^1.5",
45+
"symfony/http-foundation": "^6.4",
46+
"symfony/http-kernel": "^6.4",
47+
"simplesamlphp/saml11": "~1.2.4"
4448
},
4549
"require-dev": {
4650
"simplesamlphp/simplesamlphp-test-framework": "^1.7",
4751
"phpunit/phpunit": "^10",
4852
"psalm/plugin-phpunit": "^0.19.0",
49-
"squizlabs/php_codesniffer": "^3.7"
53+
"squizlabs/php_codesniffer": "^3.7",
54+
"maglnet/composer-require-checker": "4.7.1",
55+
"vimeo/psalm": "^5",
56+
"icanhazstring/composer-unused": "^0.8.11"
5057
},
5158
"support": {
5259
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-casserver/issues",
5360
"source": "https://github.com/simplesamlphp/simplesamlphp-module-casserver"
5461
},
55-
"suggest": {
56-
"ext-pdo": "*"
57-
},
5862
"scripts": {
5963
"validate": [
60-
"vendor/bin/phpunit --no-coverage --testdox",
61-
"vendor/bin/phpcs -p"
64+
"vendor/bin/phpcs -p",
65+
"vendor/bin/composer-require-checker check --config-file=tools/composer-require-checker.json composer.json",
66+
"vendor/bin/psalm -c psalm-dev.xml",
67+
"vendor/bin/composer-unused",
68+
"vendor/bin/phpunit --no-coverage --testdox"
6269
],
6370
"tests": [
6471
"vendor/bin/phpunit --no-coverage"
72+
],
73+
"propose-fix": [
74+
"vendor/bin/phpcs --report=diff"
6575
]
6676
}
6777
}

config/module_casserver.php.dist

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ $config = [
2626
'https://host2.domain:5678/path2/path3',
2727
// So is regex
2828
'|^https://.*\.domain.com/|',
29-
// Some configuration options can be overridden
29+
// ONLY the FOLLOWING configuration options can be overridden. See OverrideConfigPropertiesEnum.
3030
'https://override.example.com' => [
3131
'attrname' => 'uid',
3232
'attributes_to_transfer' => ['cn'],
33+
//'attributes' => false,
34+
//'authproc' => [],
35+
//'service_ticket_expire_time' => 5,
3336
],
3437
],
3538

locales/en/LC_MESSAGES/casserver.po

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,20 @@ msgstr "Logged in"
3030
msgid "You are logged in."
3131
msgstr "You are logged in."
3232

33+
msgid "{copy}"
34+
msgstr "Copy"
35+
36+
msgid "{copied}"
37+
msgstr "Copied!"
38+
39+
msgid "{continue}"
40+
msgstr "Continue"
41+
42+
msgid "{copyToClipboard}"
43+
msgstr "Copy to clipboard"
44+
45+
msgid "{success}"
46+
msgstr "Validation Successful"
47+
48+
msgid "{failure}"
49+
msgstr "Validation Failed"

phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
<!-- Use this to exclude paths. You can have multiple patterns -->
2323
<exclude-pattern>tests/config/*</exclude-pattern>
24+
<exclude-pattern>public/assets/jquery/*</exclude-pattern>
2425

2526
<!-- This is the rule we inherit from. If you want to exclude some specific rules, see the docs on how to do that -->
2627
<rule ref="PSR12"/>

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
bootstrap="tests/bootstrap.php"
55
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
66
backupGlobals="false"
7+
displayDetailsOnTestsThatTriggerWarnings="true"
78
cacheDirectory=".phpunit.cache">
89
<coverage>
910
<report>

psalm-dev.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
name="SimpleSAMLphp testsuite"
44
useDocblockTypes="true"
55
errorLevel="4"
6+
resolveFromConfigFile="true"
7+
autoloader="vendor/autoload.php"
8+
findUnusedCode="false"
9+
findUnusedBaselineEntry="true"
610
reportMixedIssues="false"
711
hideExternalErrors="true"
812
allowStringToStandInForClass="true"

psalm.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
useDocblockTypes="true"
55
errorLevel="2"
66
reportMixedIssues="false"
7+
resolveFromConfigFile="true"
8+
autoloader="vendor/autoload.php"
9+
findUnusedCode="false"
10+
findUnusedBaselineEntry="true"
11+
hideExternalErrors="true"
12+
allowStringToStandInForClass="true"
713
>
814
<projectFiles>
915
<directory name="config" />
10-
<directory name="public" />
1116
<directory name="src" />
1217
</projectFiles>
1318

0 commit comments

Comments
 (0)