> For the complete documentation index, see [llms.txt](https://docs.connect.century.tech/llms.txt)

# SSO Providers

> The SSO Providers operations let a school register its own identity provider (IdP), so that people with an email address at the domain of the school can sign in to CENTURY with single sign-on. CENTURY supports OpenID Connect (OIDC) providers.
> 
> **These operations are in preview and by invitation only.** If your organisation wants to join the preview, contact CENTURY support through your account manager. An organisation that is not in the preview gets `403 Forbidden` from each operation.
> 
> Because the operations are in preview, the contract can change. An environment where the operations are not enabled responds with `501 Not Implemented`.
> 
> ## How to set up single sign-on
> 
> 1. **Register the provider.** Send the email domain, the issuer, the client ID and the client secret with [Create SSO Provider](#operation-createSsoProvider). CENTURY reads the OIDC discovery document of the issuer. If the document is not valid, the response is `422`. The response gives the `providerId`, which CENTURY makes from the domain and which does not change.
> 2. **Allow the redirect address.** In the IdP of the school, allow the redirect address of the provider. The pattern is `{sign-in service URL}/authn/v1/api/sso/callback/{providerId}`, where `{sign-in service URL}` is the public address of the CENTURY sign-in service for your environment. Ask CENTURY support for that address.
> 3. **Get the verification record.** [Get SSO Provider Domain Verification](#operation-getSsoProviderDomainVerification) gives a DNS `TXT` record.
> 4. **Publish the record.** Add the record at the DNS host of the domain. This proves that the school controls the domain.
> 5. **Check the verification.** Call [Check SSO Provider Domain Verification](#operation-checkSsoProviderDomainVerification). When the record is found, the domain is verified and sign-in can start. You can remove the record after that.
> 
> ## Rules
> 
> - One provider holds one domain, and one domain has one provider. A school with two email domains registers two providers.
> - A subdomain is a different domain. The provider for `school.example` does not sign in addresses at `pupils.school.example`.
> - The domain of a provider cannot change. To use a different domain, delete the provider and register a new one.
> - A provider with an unverified domain cannot be used for sign-in.
> - The issuer is an HTTPS URL with a public DNS host name. It has no user name, port, query or fragment.
> - The issuer is in its normal form: the host is in lower case, and the path has no dot segments (`/./`, `/../`) and no character that must be percent-encoded. Send the issuer as the IdP gives it in the `issuer` field of its discovery document.
> - The host of the issuer must resolve to public addresses only. CENTURY refuses an IdP on a private network.
> - Each endpoint in the discovery document of the issuer must be an `https://` address.
> - The scopes are optional. If you send them, they must include `openid`.
> - The client secret is write-only. No response contains it.
> 
> ## The provider ID
> 
> CENTURY makes the `providerId` from the domain:
> 
> 1. The domain changes to lower case.
> 2. Each group of characters that are not a letter or a digit becomes one hyphen.
> 3. A hyphen at the start or at the end is removed.
> 
> For example, `school.example` gives `school-example`.
> 
> If a create does not complete in time, the provider can exist. A second create then responds with `409`. Because you can calculate the `providerId` from the domain, you can read the provider with [Get SSO Provider](#operation-getSsoProvider).
> 
> ## Changes to a provider
> 
> - **An issuer change** removes the linked IdP accounts of the provider. The users, their memberships and their sessions stay.
> - **A delete** removes the linked IdP accounts of the provider. After the delete, sign-in for the domain does not start. The users are not deleted, and a session stays valid until it expires.
> 
> ## After a `422` on create or update
> 
> The `422` for a discovery failure gives no cause. Do these steps:
> 
> 1. Open `{issuer}/.well-known/openid-configuration` in a browser. The document must be there, and its `issuer` field must be the same as the issuer that you send.
> 2. Make sure that each endpoint in the document is an `https://` address.
> 3. Make sure that the host of the issuer is on the public internet.
> 4. Send the request again. A temporary DNS failure also gives this response.
> 
> If the problem stays, speak to CENTURY support and give the issuer.
> 
> ## Problem types
> 
> An error response is a problem details object ([RFC 7807](https://datatracker.ietf.org/doc/html/rfc7807)). Use the `type` field to find the cause. The `detail` text can change.
> 
> | Status | Type | Operations |
> |---|---|---|
> | `404` | `problems/sso-providers/provider-not-found` | All operations with a `providerId` |
> | `409` | `problems/sso-providers/domain-already-in-use` | Create |
> | `422` | `problems/sso-providers/discovery-failed` | Create, update |
> | `422` | `problems/sso-providers/domain-verification-record-not-found` | Check |
> | `502` | `problems/sso-providers/domain-verification-lookup-failed` | Check. The DNS lookup failed. This is not a problem with the record. Do the check again later. |
> | `502` | `problems/sso-providers/service-unavailable` | All operations. The SSO service is not available. |
> 
> A `404` is also the response for a provider of a different organisation.

## Operations

- [Create SSO Provider](https://docs.connect.century.tech/operation/operation-createssoprovider.md)

- [Get SSO Provider](https://docs.connect.century.tech/operation/operation-getssoprovider.md)

- [Delete SSO Provider](https://docs.connect.century.tech/operation/operation-deletessoprovider.md)

- [Update SSO Provider](https://docs.connect.century.tech/operation/operation-updatessoprovider.md)

- [Get SSO Provider Domain Verification](https://docs.connect.century.tech/operation/operation-getssoproviderdomainverification.md)

- [Check SSO Provider Domain Verification](https://docs.connect.century.tech/operation/operation-checkssoproviderdomainverification.md)


[Powered by Bump.sh](https://bump.sh)
