core icon indicating copy to clipboard operation
core copied to clipboard

Add to Role per-site

Open wezell opened this issue 9 years ago • 15 comments

samluserrole: json string that matches role key ALSO add global "Saml User" role (create if does not exist)

wezell avatar Mar 03 '17 16:03 wezell

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.

wezell avatar Mar 13 '17 20:03 wezell

So to have a default saml config, you have to flag one of the saml hosts as default in its saml config

dsilvam avatar Mar 13 '17 21:03 dsilvam

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?

dotcmsCodeReview avatar Mar 13 '17 21:03 dotcmsCodeReview

After discussion with @wezell @chrismccracken and @jdotcms : saml.fallback.site=host.com in the plugin config

dsilvam avatar Mar 13 '17 22:03 dsilvam

The new field for the config on the site type will be a text area (that expects key=value) instead of a key/value

dsilvam avatar Mar 13 '17 22:03 dsilvam

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.

dsilvam avatar Mar 15 '17 17:03 dsilvam

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

dsilvam avatar Mar 15 '17 17:03 dsilvam

Make these entries the field default value when we programmatically create the field.

wezell avatar Mar 15 '17 17:03 wezell

The field will be created in the filter's init. We need to check if already exists

dsilvam avatar Mar 15 '17 17:03 dsilvam

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.

chrismccracken avatar Mar 15 '17 20:03 chrismccracken

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

dsilvam avatar Mar 15 '17 23:03 dsilvam

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.

dsilvam avatar Mar 16 '17 22:03 dsilvam

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

dsilvam avatar Mar 20 '17 18:03 dsilvam

PR: https://github.com/dotCMS/plugin-dotcms-openSAML3/pull/10

nollymar avatar Mar 21 '17 22:03 nollymar

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

shaydotcms avatar Mar 28 '17 14:03 shaydotcms