Configuring Single Sign-On (SSO)

CollectionSpace supports integration with single sign-on providers using SAML. Single sign-on can be enabled by adding connection information to a services configuration XML file.

Creating a file to store local configuration

Your configuration file should be placed in the $CSPACE_JEESERVER_HOME/cspace/config/services/local directory on the CollectionSpace server.

  1. Create the local directory if it does not exist.

  2. Inside that directory, create a file with any name of your choosing, ending with.xml; for example, services-config-sso.xml. This local configuration file will be merged with theservices-config.xml and services-config-security.xml files, found in $CSPACE_JEESERVER_HOME/cspace/config/services. You may add more than one .xml file to the local directory if you want to split your configuration into multiple files. If more than one .xml file is present in local, the files are merged into the configuration in alphabetical order.

  3. Add configuration to your file(s), following the example and instructions below.

Your local configuration is merged with the default configuration files when CollectionSpace starts. For debugging, the output of the merge is written to $CSPACE_JEESERVER_HOME/cspace/config/services/service-config.merged.xml

SAML configuration settings

Your merged XML file must conform to the XML schema at https://github.com/collectionspace/services/blob/v8.0-branch/services/config/src/main/resources/service-config.xsd . That schema defines the security/sso/saml element that contains the configuration for SAML SSO.

The following example shows a typical SSO configuration file:

<?xml version="1.0" encoding="UTF-8"?> <svc:service-config xmlns:svc='http://collectionspace.org/services/config' xmlns:merge='http://xmlmerge.el4j.elca.ch' > <security> <sso> <saml> <single-logout /> <relying-party-registrations> <relying-party id="auth0"> <name>Auth0</name> <icon location="https://cdn.auth0.com/manhattan/versions/1.4478.0/assets/badge.png" /> <metadata location="https://dev-vynkcnqhac3c0s10.us.auth0.com/samlp/metadata/aiXoltFSsQymeHorBxWM5pGLxnslocpe" /> <assertion-username-probes> <attribute name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" /> </assertion-username-probes> <signing-x509-credentials> <x509-credential> <private-key location="file:///home/collectionspace/tomcat/cspace/services/credentials/private.key" /> <x509-certificate location="file:///home/collectionspace/tomcat/cspace/services/credentials/certificate.crt" /> </x509-credential> </signing-x509-credentials> <decryption-x509-credentials> <x509-credential> <private-key location="file:///home/collectionspace/tomcat/cspace/services/credentials/private.key" /> <x509-certificate location="file:///home/collectionspace/tomcat/cspace/services/credentials/certificate.crt" /> </x509-credential> </decryption-x509-credentials> </relying-party> </relying-party-registrations> </saml> </sso> </security> </svc:service-config>

The merge result can be fine tuned by adding attributes from the merge namespace defined in the example. In most cases, the default merge behavior (no merge attributes, as above) is sufficient. See the XmlMerge documentation for details.

Some important elements inside saml include:

 

single-logout

The presence of this element enables SAML single logout (SLO). At present, only RP-initiated logout (logging out of CollectionSpace also logs the user out of the SAML identity provider) is supported. AP-initiated logout (logging out of the SAML IdP also logs the user out of CollectionSpace) may be supported in the future.

Enabling single logout enables the feature for every registered relying party. There is currently no way to enable SLO only for certain relying parties.

 

relying-party-registrations

Registers SAML relying parties. A relying-party in this configuration file can be thought of as a connection between CollectionSpace and a SAML identity provider.

 

relying-party

Configures a connection between CollectionSpace and a SAML IdP.

The required id attribute specifies a registration ID that must be unique among all relying parties.

This ID appears in the URLs of CSpace REST API endpoints. For readability, it is recommended to use only URL-friendly characters.

 

name

The user-friendly name of the connection. This is used in the user interface, so it should be human readable, and familiar to end-users of the identity provider. The metadata provided by an IdP sometimes contains a suitable name, but this setting currently is not automatically configured from the metadata.

If the name element is not present, the id is displayed in the user interface.

 

icon

An icon (logo) image to use in the user interface for this connection. The metadata provided by an IdP sometimes contains a suitable image, but this setting currently is not automatically configured from the metadata.

The required location attribute contains the URL of the image. This may be a file:// URL, if the image can be found in a local file.

If the icon element is not present, a default icon is displayed in the user interface.

 

metadata

The XML-formatted metadata provided by the SAML identity provider.

The required location attribute contains the URL of the metadata. This may be a file:// URL, if the metadata can be found in a local file.

 

assertion-username-probes

A list of locations in a SAML assertion returned by the identity provider to look for the username of a CollectionSpace user. A location is either an attribute in the assertion or the NameID of the assertion. Each location is probed in the order given. If it contains something that looks like an email address, an attempt is made to locate a CSpace user whose username is equal to that email. Once a user is found, probing of locations stops.

name-id

Specifies that the NameID of the assertion is a possible location of the email/username.

attribute

Specifies that an attribute in the assertion is a possible location of the email/username. The required name attribute specifies the name of the attribute in the assertion.

Defaults to:

<name-id />

<attribute name="urn:oid:0.9.2342.19200300.100.1.3" />

<attribute name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" />

<attribute name="email" />

<attribute name="mail" />

 

signing-x509-credentials

A list of credentials to use for signing SAML requests issued by CollectionSpace. Typically, you will only specify a single credential (private key and certificate pair). A credential is required if the identity provider requires login requests to be signed (as reported in its metadata), or if single logout is enabled. Otherwise, signing credentials are optional.

 

x509-credential

A signing credential.

 

private-key

The private key to be used for signing. The key can either be specified in the content of the element, or as a URL.

If the key is not set as the content of the element, use the location attribute to specify the URL where the key can be found. This may be a file:// URL, if the key can be found in a local file.

 

x509-certificate

The certificate to be used to validate a document signed with the private key. The certificate can either be specified in the content of the element, or as a URL.

If the certificate is not set as the content of the element, use the location attribute to specify the URL where the certificate can be found. This may be a file:// URL, if the certificate can be found in a local file.

decryption-x509-credentials

A list of credentials to use for encrypting and decrypting SAML assertions issued by the IdP. Typically, you will only specify a single credential (private key and certificate pair). A credential is required if the identity provider requires its assertions to be encrypted. Otherwise, decryption credentials are optional. The content of decryption-x509-credentials has the same structure as signing-x509-credentials, but the decryption and signing credentials may differ.

Retrieving CollectionSpace SAML Metadata

Restart the CollectionSpace server to activate your SSO configuration. CollectionSpace SAML metadata for a configured relying party can be retrieved from the REST API at:

/cspace-services/saml2/service-provider-metadata/{id}

(Replace {id} with the value of the id attribute of the relying-party in your configuration).

This URL can be provided to the administrator of the SAML identity provider in order to complete the connection.