Add to Role per-site
samluserrole: json string that matches role key ALSO add global "Saml User" role (create if does not exist)
So, we will look for a key value field with a fieldVar=saml which will have the host configuration properties
If a host does not have a fieldVar, then we will fall back to the fieldVar on the defualt host.
So to have a default saml config, you have to flag one of the saml hosts as default in its saml config
So you have 1000 hosts. How are we going to find the one set to default in the key/value pairs? If you unset one, are you going to go and unset the others?
After discussion with @wezell @chrismccracken and @jdotcms : saml.fallback.site=host.com in the plugin config
The new field for the config on the site type will be a text area (that expects key=value) instead of a key/value
We also need to catch any edit (on Site Publish (save)) to the Site name or alias, not just the SAML config. This is suggested to be done via a post hook.
when we re-init the SAML filter on the Site save post-hook we need to catch if there is some SAML config but there is missing critical SAML config and log the init failure appropriately
The critical config elements that are always needed are: service.provider.issuer idp.metadata.path keystore.path keystore.password keystore.entry.password (maybe default to keystore.password if !defined)
Everything else we should be able to have usable defaults
Make these entries the field default value when we programmatically create the field.
The field will be created in the filter's init. We need to check if already exists
For service.provider.issuer, we can actually pick up a default from the dotCMS Site name if it is not defined. I don't think we need to strictly require that config if we use this pattern.
if saml.fallback.site is not set correctly ( saml.fallback.site=“” or saml.fallback.site=some.site.doesnt.exist.com), we won't set a default host, thus, the ones without config will use native login
To Doc: indicate that the system needs to be started at least once (schema created) before installing the plugin. This is because the SAML filter's init is executed before MainServlet's init, where the scheme is created.
As discussed with @chrismccracken
Two tasks there for post-authentication:
-
Assign the user to the “SAML User” Role (the same as what we do with the “LDAP User” Role. If this role does not exist, create it and then assign
-
Assign the user to the role with rolekey matching the configured "saml_user_role” if it is configured (don’t do anything if it is not configured)
So each SAML user will have three categories of roles that should be assigned:
- SAML User role
- A role as configured from saml_user_role (optional)
- Any roles from the SAML assertion (optional)
saml_user_role should come from the text_area config
PR: https://github.com/dotCMS/plugin-dotcms-openSAML3/pull/10
Passed QA Tested locally using dotcms_3.7.1 release Mac OS 10.10 / MySQL 5.6.35 / Firefox v45.0.1 / Tomcat 8 / Java 8