Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b8bb0e6
Add documentation for UNIX socket connections
nathanjrobertson Oct 12, 2025
d4efc2e
Spelling fix
nathanjrobertson Oct 12, 2025
f50130b
Merge pull request #19 from nathanjrobertson/unix_socket_docs
tvdijen Oct 13, 2025
2286d34
Implement sqlauth v2 - support multiple databases, multiple authentic…
nathanjrobertson Oct 17, 2025
facb328
Support password_verify() in version 2. Provide v1 compat interfaces.
nathanjrobertson Oct 20, 2025
9e62356
Fix phpcs errors and warnings
nathanjrobertson Oct 20, 2025
de4021b
phpstan fixes
nathanjrobertson Oct 20, 2025
c0a0e77
More phpstan fixes
nathanjrobertson Oct 20, 2025
51c60e7
Provide documentation for the Version 2 configuration format
nathanjrobertson Oct 21, 2025
92221a0
Fix linting for README
nathanjrobertson Oct 22, 2025
bac816c
Fix linting
nathanjrobertson Oct 22, 2025
80574d5
Spelling fixes
nathanjrobertson Oct 22, 2025
693a255
Run phpcs from vendor, not GitHub installed version
nathanjrobertson Oct 22, 2025
833cd52
Fix deprecation warnings in phpunit, strangely causing phpunit failur…
nathanjrobertson Oct 22, 2025
86da39e
composer install with "--prefer-dist" fails. Remove that flag.
nathanjrobertson Oct 22, 2025
26aabd0
Merge branch 'master' into sql2
tvdijen Oct 22, 2025
64142b9
Have test classes use concrete interface to make it clearer to phpsta…
nathanjrobertson Oct 23, 2025
8761cb7
Add wrapper interface to bootstrap.php
nathanjrobertson Oct 23, 2025
6a2919e
Remove require_all() lines in bootstrap.php. Move to using autoload-d…
nathanjrobertson Oct 23, 2025
1230b28
Fix scrutinizer issues
nathanjrobertson Oct 23, 2025
4b38aa5
Move password_verify_hash_column handling from login into a member fu…
nathanjrobertson Oct 27, 2025
e510ce7
Merge branch 'simplesamlphp:master' into sql2
nathanjrobertson Oct 27, 2025
0ffef41
Fix core:loginpage_links (and other extra parameters) in SQL1 compat …
nathanjrobertson Nov 3, 2025
d53f98a
Merge branch 'sql2' of github.com:nathanjrobertson/simplesamlphp-modu…
nathanjrobertson Nov 3, 2025
3f511dd
Add test case for database ID being wrong in configuration
nathanjrobertson Nov 10, 2025
2333422
Fix phpcs error
nathanjrobertson Nov 10, 2025
a495d6b
Improve readability of authenticatePasswordVerifyHash()
nathanjrobertson Nov 11, 2025
6b4e981
Drop reference to most recently used database in the cleanup phase
nathanjrobertson Nov 11, 2025
630316d
Make error handling for missing databases key more obvious
nathanjrobertson Nov 11, 2025
618e0d3
Make error handling for missing auth_queries key more obvious
nathanjrobertson Nov 11, 2025
9b83f78
Fix $winning_auth_query not being camelCase
nathanjrobertson Nov 11, 2025
2d7157b
Upgrade simplesamlphp/composer-module-installer dependency from ~1.5.…
nathanjrobertson Nov 19, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ jobs:
with:
# Should be the lowest supported version
php-version: '8.2'
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, posix, spl, xml
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, posix, spl, xml, zip
tools: composer
coverage: none

Expand All @@ -237,7 +237,7 @@ jobs:
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req=ext-posix

- name: Security check for locked dependencies
run: composer audit
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
},
"autoload-dev": {
"psr-4": {
"SimpleSAML\\Test\\Utils\\": "vendor/simplesamlphp/simplesamlphp/tests/Utils"
"SimpleSAML\\Test\\Utils\\": "vendor/simplesamlphp/simplesamlphp/tests/Utils",
"SimpleSAML\\Test\\Module\\sqlauth\\Auth\\Source\\": "tests/src/Auth/Source/"
}
},
"require": {
Expand Down
547 changes: 492 additions & 55 deletions docs/sql.md

Large diffs are not rendered by default.

28 changes: 8 additions & 20 deletions phpstan-baseline-dev.neon
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
parameters:
ignoreErrors:
-
message: '#^Parameter \#1 \$array of function asort expects array, string given\.$#'
identifier: argument.type
count: 4
path: tests/src/Auth/Source/PasswordVerifyTest.php
message: '#^Property SimpleSAML\\Test\\Module\\sqlauth\\Auth\\Source\\SQL2MultipleAuthTest\:\:\$config type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/src/Auth/Source/SQL2MultipleAuthTest.php

-
message: '#^Property SimpleSAML\\Test\\Module\\sqlauth\\Auth\\Source\\PasswordVerifyTest\:\:\$config \(array\<string, string\|null\>\) does not accept array\<string, list\<string\>\|string\|null\>\.$#'
identifier: assign.propertyType
count: 4
path: tests/src/Auth/Source/PasswordVerifyTest.php

-
message: '#^Parameter \#1 \$array of function asort expects array, mixed given\.$#'
identifier: argument.type
count: 4
path: tests/src/Auth/Source/SQLTest.php

-
message: '#^Property SimpleSAML\\Test\\Module\\sqlauth\\Auth\\Source\\SQLTest\:\:\$config \(array\<string, string\|null\>\) does not accept array\<string, list\<string\>\|string\|null\>\.$#'
identifier: assign.propertyType
count: 4
path: tests/src/Auth/Source/SQLTest.php
message: '#^Property SimpleSAML\\Test\\Module\\sqlauth\\Auth\\Source\\SQL2SimpleTest\:\:\$config type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/src/Auth/Source/SQL2SimpleTest.php
66 changes: 66 additions & 0 deletions src/Auth/Source/PasswordVerify1Compat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

declare(strict_types=1);

namespace SimpleSAML\Module\sqlauth\Auth\Source;

/**
* @package SimpleSAMLphp
*/

class PasswordVerify1Compat extends SQL2
{
/**
* Constructor for this authentication source.
*
* @param array $info Information about this authentication source.
* @param array $config Configuration.
*/
public function __construct(array $info, array $config)
{
/* Transform PasswordVerify (version 1) config to SQL2 config
* Version 1 supported only one database, but multiple queries. The first query was defined
* to be the "authentication query", all subsequent queries were "attribute queries".
*/
$v2config = [
'sqlauth:SQL2',
'databases' => [
'default' => [
'dsn' => $config['dsn'],
'username' => $config['username'],
'password' => $config['password'],
],
],

'auth_queries' => [
'default' => [
'database' => 'default',
'query' => is_array($config['query']) ? $config['query'][0] : $config['query'],
'password_verify_hash_column' => 'passwordhash',
],
],
];

if (array_key_exists('username_regex', $config)) {
$v2config['auth_queries']['default']['username_regex'] = $config['username_regex'];
}

// Override the default passwordhash column if configured
if (array_key_exists('passwordhash_column', $config)) {
$v2config['auth_queries']['default']['password_verify_hash_column'] = $config['passwordhash_column'];
}

$numQueries = is_array($config['query']) ? count($config['query']) : 0;
if ($numQueries > 1) {
$v2config['attr_queries'] = [];
for ($i = 1; $i < $numQueries; $i++) {
$v2config['attr_queries']['query' . $i] = [
'database' => 'default',
'query' => $config['query'][$i],
];
}
}

parent::__construct($info, $v2config);
}
}
60 changes: 60 additions & 0 deletions src/Auth/Source/SQL1Compat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

declare(strict_types=1);

namespace SimpleSAML\Module\sqlauth\Auth\Source;

/**
* @package SimpleSAMLphp
*/

class SQL1Compat extends SQL2
{
/**
* Constructor for this authentication source.
*
* @param array $info Information about this authentication source.
* @param array $config Configuration.
*/
public function __construct(array $info, array $config)
{
/* Transform SQL (version 1) config to SQL2 config
* Version 1 supported only one database, but multiple queries. The first query was defined
* to be the "authentication query", all subsequent queries were "attribute queries".
*/
$v2config = [
'sqlauth:SQL2',
'databases' => [
'default' => [
'dsn' => $config['dsn'],
'username' => $config['username'],
'password' => $config['password'],
],
],

'auth_queries' => [
'default' => [
'database' => 'default',
'query' => is_array($config['query']) ? $config['query'][0] : $config['query'],
],
],
];

if (array_key_exists('username_regex', $config)) {
$v2config['auth_queries']['default']['username_regex'] = $config['username_regex'];
}

$numQueries = is_array($config['query']) ? count($config['query']) : 0;
if ($numQueries > 1) {
$v2config['attr_queries'] = [];
for ($i = 1; $i < $numQueries; $i++) {
$v2config['attr_queries']['query' . $i] = [
'database' => 'default',
'query' => $config['query'][$i],
];
}
}

parent::__construct($info, $v2config);
}
}
Loading