cryptpad / sso

CryptPad official SSO plugin
https://cryptpad.org
GNU Affero General Public License v3.0
13 stars 6 forks source link

More information on metadata for SAML2 authentication #10

Closed nwintering closed 2 months ago

nwintering commented 3 months ago

Hi, we are running a Shibboleth Identity Provider and would like to authenticate Cryptpad user via SAML2. I would like to know where to find all the metadata about the Cryptpad Service Provider in order to attach it to our Identity Provider. Things I need to know:

There might be further required metadata. I am not sure.

Could someone elaborate on the documentation?

yflory commented 3 months ago

Hi,

The documentation for SAML2 is indeed incomplete and we welcome any suggestion or pull request to improve it. We don't have a SAML expert in the team so if some cases are not handled properly, please tell us and we'll improve the plugin to support it.

Once the sso plugin is installed in the cryptpad plugin directory, you can make a copy of the sso example and base your config on the SAML example:

When your configuration file is ready, you can run node lib/plugins/sso/get-saml-metadata.js from the root of the cryptpad repo to print the xml containing the Service Provider metadata.

Example config:

const fs = require('node:fs');
module.exports = { 
    // Enable SSO login on this instance
    enabled: true,
    // Block registration for non-SSO users on this instance
    enforced: false,
    // Allow users to add an additional CryptPad password to their SSO account
    cpPassword: true,
    // You can also force your SSO users to add a CryptPad password
    forceCpPassword: false,
    // List of SSO providers
    list: [{
        name: 'Your SSO name', // displayed as a login option in the UI
        type: 'saml',
        url: 'https://your-saml-idp/sso', // the SSO url
        issuer: 'your-cryptpad-issuer-id', // entityD
        cert: fs.readFileSync("./your-idp-cert.txt", "utf-8"),
        privateKey: fs.readFileSync("./your-private-key", "utf-8"),
        signingCert: fs.readFileSync("./your-signing-cert", "utf-8"),
    }]   
};

Please tell us if this answers your questions or if something is still unclear and we'll update the documentation later.

nwintering commented 2 months ago

Thanks! This gives me good starting point for testing. I will try this out on occasion.