Apereo CAS - dotCMS SAML2 Integration


Collaborate
The blog is managed and hosted on GitHub. If you wish to update the contents of this post or if you have found an inaccuracy and wish to make corrections, we recommend that you please submit a pull request to this repository.
Contributed Content
Keith Conger of Colorado College, an active member of the CAS community, was kind enough to contribute this guide.

dotCMS is an open source content management system (CMS) written in Java for managing content and content-driven sites and applications. As a SAML2 service provider, dotCMS can be integrated with CAS running as a SAML identity provider and this blog post provides a quick walkthrough of how to make that integration possible.

Our starting position is based on the following:

Configuration

First, ensure that your CAS deployment is equipped to act as a SAML2 identity provider. Next, you may also use the JSON Service Registry to keep track of the dotCMS relying-party registration record in JSON definition files.

The JSON file to contain the dotCMS registration record would be as follows:

{
  @class: org.apereo.cas.support.saml.services.SamlRegisteredService
  serviceId: your-dotcms-entity-id
  name: dotCMS
  id: 1
  description: dotCMS Content Mangement System
  attributeReleasePolicy:
  {
    @class: org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy
    attributeFilter:
    {
      @class: org.apereo.cas.services.support.RegisteredServiceMutantRegexAttributeFilter
      patterns:
      {
        @class: java.util.LinkedHashMap
        memberOf: (?<=CN=)([^,]+)->$1
      }
    }
    allowedAttributes:
    [
      java.util.ArrayList
      [
        mail
        givenName
        memberOf
        sn
      ]
    ]
  }
  metadataLocation: https://path.to.your.dotcmscloud.com/dotsaml/metadata/3dd4ad1e-e2ab-492e-a428-87af35d341fd
  signAssertions: true
  skipGeneratingSubjectConfirmationNotBefore: true
  signResponses: true
}

A few things to point out:

  • You will of course need to adjust the serviceId and metadataLocation to match your data and dotCMS instance.
  • Make sure the AssertionConsumerService endpoint in the dotCMS metadata contains the urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect binding.
  • Make sure CAS has retrieved the allowed attributes (i.e. mail, givenName, etc) listed in the JSON definition file.
  • Regarding the memberOf attribute, the values fetched from the directory are typically in the format of CN=WebAdmin,OU=something,OU=something,DC=somewhere,DC=edu. The service provider requires only the CN portion of the attribute value where CAS would need to produce <saml2:AttributeValue>WebAdmin</saml2:AttributeValue> instead of <saml2:AttributeValue>CN=WebAdmin,OU=something,OU=something,DC=somewhere,DC=edu</saml2:AttributeValue>. This bit is handled via the RegisteredServiceMutantRegexAttributeFilter element in the JSON file.

Finale

Thanks to Keith Conger of Colorado College who was kind enough to share the above integration notes. If you too have an integration with a well-known SAML2 service provider, please consider sharing that guide in form of a blog post here as well.

Misagh Moayyed

Related Posts

CAS 6.0.0 RC4 Feature Release

...in which I present an overview of CAS 6.0.0 RC4 release.

Apereo CAS 6.0.x - Building CAS Feature Modules

An overview of how various CAS features modules today can be changed and tested from the perspective of a CAS contributor working on the codebase itself to handle a feature request, bug fix, etc.

CAS 6.0.x Deployment - WAR Overlays

Learn how to configure and build your own CAS deployment via the WAR overlay method, get rich quickly, stay healthy indefinitely and respect family and friends in a few very easy steps.

Apereo CAS - Jib at CAS Docker Images

Learn how you may use Jib, an open-source Java containerizer from Google, and its Gradle plugin to build CAS docker images seamlessly without stepping too deep into scripting Dockerfile commands.

Apereo CAS 6 - Administrative Endpoints & Monitoring

Gain insight into your running Apereo CAS 6 deployment in production. Learn how to monitor and manage the server by using HTTP endpoints and gather metrics to diagnose issues and improve performance.

Apereo CAS - SAML2 Metadata with MongoDb

CAS distributed SAML2 metadata management using MongoDB, where you learn how to store metadata documents inside MongoDB for CAS as a SAML2 identity provider and all other registered SAML2 service providers.

Apereo CAS - Slurp Configuration with Groovy

Learn how CAS configuration may be consumed via Groovy to simplify and consolidate settings for multiple deployment environments and profiles.

Apereo CAS - Configuration Management with MongoDb

CAS distributed configuration management using MongoDb, where you learn how to store and secure CAS configuration settings and properties inside MongoDb.

Apereo CAS - Integration with HashiCorp Vault

CAS distributed configuration management using HashCorp Vault, where you learn how to store and secure CAS configuration settings and properties inside Vault.

CAS 6.0.0 RC3 Feature Release

...in which I present an overview of CAS 6.0.0 RC3 release.