NIIF / simplesamlphp-module-attributescope

Filter to remove attribute values which are not properly scoped.
1 stars 4 forks source link

refactor: refactoring for ssp 2.0.0 #7

Open szabogyula opened 2 years ago

ghalse commented 1 year ago

I get an exception with this patch on SSP 2.0.0-rc2:

SimpleSAML\Error\Error: UNHANDLEDEXCEPTION
Backtrace:
2 www/_include.php:28 (SimpleSAML_exception_handler)
1 vendor/symfony/error-handler/ErrorHandler.php:607 (Symfony\Component\ErrorHandler\ErrorHandler::handleException)
0 [builtin] (N/A)
Caused by: Exception: Could not resolve 'attributescope:FilterAttributes': The class 'SimpleSAML\Module\attributescope\Auth\Process\FilterAttributes' isn't a subclass of '\SimpleSAML\Auth\ProcessingFilter'.
Backtrace:
8 src/SimpleSAML/Module.php:459 (SimpleSAML\Module::resolveClass)
7 src/SimpleSAML/Auth/ProcessingChain.php:158 (SimpleSAML\Auth\ProcessingChain::parseFilter)
6 src/SimpleSAML/Auth/ProcessingChain.php:134 (SimpleSAML\Auth\ProcessingChain::parseFilterList)
5 src/SimpleSAML/Auth/ProcessingChain.php:67 (SimpleSAML\Auth\ProcessingChain::__construct)
4 modules/saml/src/Auth/Source/SP.php:1126 (SimpleSAML\Module\saml\Auth\Source\SP::handleResponse)
3 [builtin] (call_user_func_array)
2 src/SimpleSAML/HTTP/RunnableResponse.php:72 (SimpleSAML\HTTP\RunnableResponse::sendContent)
1 vendor/symfony/http-foundation/Response.php:394 (Symfony\Component\HttpFoundation\Response::send)
0 /opt/simplesamlphp-1.19.4/www/module.php:10 (N/A)

So far as I can tell, it's because you've declared the namespace as SimpleSAML\Module\niif\attributescope\Auth\Process whereas it is expecting SimpleSAML\Module\attributescope\Auth\Process based on the module name.

Removing the niif/ from the class name seems to fix the problem.

ghalse commented 1 year ago

Removing the niif/ from the class name seems to fix the problem.

Just to note this is still the case on SSP 2.0.3. I'm fixing it with this patch:

--- attributescope/src/Auth/Process/FilterAttributes.php.orig   2023-01-09 11:25:21.586924098 +0200
+++ attributescope/src/Auth/Process/FilterAttributes.php    2023-01-09 11:25:37.754923580 +0200
@@ -23,7 +23,7 @@
  * @link     https://github.com/niif/simplesamlphp-module-attributescope
  */

-namespace SimpleSAML\Module\niif\attributescope\Auth\Process;
+namespace SimpleSAML\Module\attributescope\Auth\Process;
 use SimpleSAML\Auth;
 use SimpleSAML\Logger;