Another SAML provider
When you finish this page, your workspace's people sign in through any SAML 2.0 identity provider. The page also lists what Kindgi needs from that provider.
Before you start
Section titled “Before you start”- Sign-in is on for your runtime, and you're an admin of the workspace,
with the
kindgiCLI set up as Set up SSO says. - Someone who can create a SAML app in your identity provider.
openssl, if your identity provider wants signed sign-in requests (When your identity provider wants signed requests).- For
kindgicommands: Kindgi 0.8's CLI, which runs from any folder asnpx --yes @kindgi/cli@0.8(Install). Inside a pack project,pnpm exec kindgiruns the project's pinned CLI instead.
1. Get the SAML URLs
Section titled “1. Get the SAML URLs”start with --kind=saml gives you the URLs a SAML app asks for:
npx --yes @kindgi/cli@0.8 sso providers start acme-saml --kind=samlacme-samlis the provider's id in your workspace.--kind=samlasks for a SAML provider's URLs: its ACS URL and its entity ID.
Sign-in with "acme-saml" (SAML). Send this to whoever runs your identity provider:
Create a SAML 2.0 application for Kindgi. ACS URL (single sign-on URL): http://localhost:18096/auth/sso/saml2/sp/acs/idp-o2ff6ocaeflrtl4qeknbutvlru Entity ID (audience): http://localhost:18096/auth/sso/saml2/sp/metadata?providerId=idp-o2ff6ocaeflrtl4qeknbutvlru Service provider metadata: http://localhost:18096/auth/sso/saml2/sp/metadata?providerId=idp-o2ff6ocaeflrtl4qeknbutvlru Name ID: the email address (or an `email` attribute). Sign the assertions. Let in only the people who should use Kindgi (assign users or groups).
Send back: the identity provider's metadata XML.
Step by step: https://docs.kindgi.com/v0.1/guides/sso/saml/
Then register it: kindgi sso providers finish acme-saml --kind=saml --idp-metadata=@<metadata.xml> --domains=<your-domain>
These URLs stay the same after registering and after any `update`.2. Create the app in your identity provider
Section titled “2. Create the app in your identity provider”Kindgi needs these from the app:
- The ACS URL and the entity ID that
startprinted. The entity ID is also called the audience. Many identity providers can read both from Kindgi's service provider metadata URL instead. - The person's email as the Name ID, or in an
emailattribute. - Signed assertions.
- Only the people who should use Kindgi, assigned to the app as users or groups.
Save the identity provider's metadata XML to a file, such as
idp-metadata.xml.
3. Register it
Section titled “3. Register it”finish registers the app with its metadata, and offers it to people at
your domains:
npx --yes @kindgi/cli@0.8 sso providers finish acme-saml --kind=saml --idp-metadata=@idp-metadata.xml --domains=<your domain>--kind=samlsays the provider speaks SAML.--idp-metadata=@<file>reads the identity provider's metadata from the file. The@is required.<your domain>is your organization's email domain, such asacme.com. For more than one, separate them with commas.
finish prints the registration, as in
Set up SSO.
When your identity provider wants signed requests
Section titled “When your identity provider wants signed requests”If the metadata says WantAuthnRequestsSigned="true", Kindgi must sign its
sign-in requests. Keycloak's metadata always says so. finish then refuses
without a key:
Error [identity-provider-invalid]: The identity provider wants signed sign-in requests (its metadata says WantAuthnRequestsSigned="true"): make a signing key and certificate, put the key (PEM) in the secret store, and set `spSigningKeyRef` to its name and `spSigningCertificates` to the certificateMake a key and certificate, and store the key in Kindgi's secret store by name:
openssl req -x509 -newkey rsa:2048 -nodes -keyout acme-sp-key.pem -out acme-sp-cert.pem -days 730 -subj "/CN=Kindgi SAML (acme.test)"npx --yes @kindgi/cli@0.8 secrets set ACME_SAML_SIGNING_KEY --env=prod --scope=tenant --from-stdin < acme-sp-key.pemreq -x509makes a self-signed certificate, and-newkey rsa:2048a new 2048-bit RSA key for it.-nodesleaves the key file unencrypted, so Kindgi can read it.-keyoutand-outname the key's file and the certificate's file.-days 730makes the certificate last two years.-subjsets the certificate's name. Use your own domain in it.--envis the env your runtime serves, itsKINDGI_ENV:prodhere, as on Kindgi Cloud.kindgi auth whoamiprints yours, in itsservedEnvfield (Three things called env).--scope=tenantstores the key for the whole workspace.--from-stdinmakessetread the key from its input, instead of asking for it.< acme-sp-key.pemgives it the key file as that input.
openssl prints its progress, then a line of dashes. Then set prints what
it stored:
…-----{ "name": "ACME_SAML_SIGNING_KEY", "scope": { "kind": "tenant", "tenantId": "6c0bd33e-e941-439b-bd0c-c7e412db29fc" }, "envName": "prod", "versionId": 1}
Set ACME_SAML_SIGNING_KEY at tenant in prod.Then run finish again with the key's name and its certificate:
npx --yes @kindgi/cli@0.8 sso providers finish acme-saml --kind=saml --idp-metadata=@idp-metadata.xml --domains=<your domain> \ --sp-signing-key-ref=ACME_SAML_SIGNING_KEY --sp-signing-certificate=@acme-sp-cert.pem--sp-signing-key-refis the signing key's name in the secret store.--sp-signing-certificateis its certificate's file. Kindgi's service provider metadata then carries the certificate, so an identity provider that imports the metadata has it. If yours doesn't, give whoever runs itacme-sp-cert.pemto add to the app.- The flag comes with CLI 0.7.0, and the metadata carries the
certificate on runtime 0.7.0 or later. An earlier runtime takes the
certificate and keeps none:
sso providers get acme-samlthen shows nospSigningCertificates, and the identity provider goes on refusing the signed requests.
To change the key, first run update with both certificates, the old
key's and the new one's, each with its own --sp-signing-certificate. Once
the identity provider has the new metadata, run update again with the new
key's name and only its certificate.
Keycloak has these steps for one identity provider, checked end to end.
- Add people, and try it: only people you've added get in.
- Sign in to the console: what your people see.
- Change it, list it, remove it.