SAML-Toolkits / wordpress-saml

OneLogin SAML plugin for Wordpress
MIT License
65 stars 75 forks source link

Keycloak + WordPress redirect to blank #126

Open uhlhosting opened 2 years ago

uhlhosting commented 2 years ago

After setting up Keycloak tried to login with created users, got this url after login blank

https://uhl.site/wp-login.php?saml_acs

Fatal error: Uncaught OneLogin\Saml2\ValidationError: Found an Attribute element with duplicated Name in /www/wwwroot/uhl.site/wp-content/plugins/onelogin-saml-sso/php/lib/Saml2/Response.php:819 Stack trace: #0 /www/wwwroot/uhl.site/wp-content/plugins/onelogin-saml-sso/php/lib/Saml2/Response.php(781): OneLogin\Saml2\Response->_getAttributesByKeyName() #1 /www/wwwroot/uhl.site/wp-content/plugins/onelogin-saml-sso/php/lib/Saml2/Auth.php(238): OneLogin\Saml2\Response->getAttributes() #2 /www/wwwroot/uhl.site/wp-content/plugins/onelogin-saml-sso/php/functions.php(240): OneLogin\Saml2\Auth->processResponse() #3 /www/wwwroot/uhl.site/wp-content/plugins/onelogin-saml-sso/php/functions.php(20): saml_acs() #4 /www/wwwroot/uhl.site/wp-includes/class-wp-hook.php(303): saml_checker() #5 /www/wwwroot/uhl.site/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters() #6 /www/wwwroot/uhl.site/wp-includes/plugin.php(470): WP_Hook->do_action() #7 /www/wwwroot/uhl.site/wp-settings.php(578): do_action() #8 /www/wwwroot/uhl.site/wp-config in /www/wwwroot/uhl.site/wp-content/plugins/onelogin-saml-sso/php/lib/Saml2/Response.php on line 819

pitbulk commented 2 years ago

It seems keycloack is generating duplicate Attributes inside the AttributeStatement.

php-saml has an option to allow this: allowRepeatAttributeName

You need to edit at the wordpress-saml plugin at php/settings.php, Inside the security array

add


"allowRepeatAttributeName" => true,
uhlhosting commented 2 years ago

I will give it a try, do you have any guides maybe specific to keycloak saml and wordpress I could dig up?