mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
d6d4f35cf5
These files are imported from HedgeDoc 1 / the master branch. Signed-off-by: David Mehren <git@herrmehren.de>
3.4 KiB
3.4 KiB
Authentication guide - SAML
Note: This guide was written before the renaming. Just replace HackMD
with CodiMD
in your mind 😄 thanks!
The basic procedure is the same as the case of OneLogin which is mentioned in OneLogin-Guide. If you want to match your IdP, you can use more configurations as below.
-
If your IdP accepts metadata XML of the service provider to ease configuration, use this url to download metadata XML.
- {{your-serverurl}}/auth/saml/metadata
- Note: If not accessible from IdP, download to local once and upload to IdP.
-
Change the value of
issuer
,identifierFormat
to match your IdP.issuer
: A unique id to identify the application to the IdP, which is the base URL of your CodiMD as defaultidentifierFormat
: A format of unique id to identify the user of IdP, which is the format based on email address as default. It is recommend that you use as below.- urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress (default)
- urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
config.json
:{ "production": { "saml": { /* omitted */ "issuer": "mycodimd" "identifierFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" } } }
- environment variables
CMD_SAML_ISSUER=mycodimd CMD_SAML_IDENTIFIERFORMAT=urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
-
Change mapping of attribute names to customize the displaying user name and email address to match your IdP.
attribute
: A dictionary to map attribute namesattribute.id
: A primary key of user table for your CodiMDattribute.username
: Attribute name of displaying user name on CodiMDattribute.email
: Attribute name of email address, which will be also used for Gravatar- Note: Default value of all attributes is NameID of SAML response, which is email address if
identifierFormat
is default.
- Note: Default value of all attributes is NameID of SAML response, which is email address if
config.json
:{ "production": { "saml": { /* omitted */ "attribute": { "id": "sAMAccountName", "username": "displayName", "email": "mail" } } } }
- environment variables
CMD_SAML_ATTRIBUTE_ID=sAMAccountName CMD_SAML_ATTRIBUTE_USERNAME=nickName CMD_SAML_ATTRIBUTE_EMAIL=mail
-
If you want to control permission by group membership, add group attribute name and required group (allowed) or external group (not allowed).
groupAttribute
: An attribute name of group membershiprequiredGroups
: Group names array for allowed access to CodiMD. Use vertical bar to separate for environment variables.externalGroups
: Group names array for not allowed access to CodiMD. Use vertical bar to separate for environment variables.- Note: Evaluates
externalGroups
first
- Note: Evaluates
config.json
:{ "production": { "saml": { /* omitted */ "groupAttribute": "memberOf", "requiredGroups": [ "codimd-users", "board-members" ], "externalGroups": [ "temporary-staff" ] } } }
- environment variables
CMD_SAML_GROUPATTRIBUTE=memberOf CMD_SAML_REQUIREDGROUPS=codimd-users|board-members CMD_SAML_EXTERNALGROUPS=temporary-staff