Sign in through a SAML identity provider
A SAML provider lets the people of a realm sign in with an identity provider their organization already runs, such as Microsoft Entra ID, Okta, or ADFS. Authwise is the service provider: it sends the person to the identity provider, receives the signed assertion, and creates or matches the account. This page shows the exchange with Microsoft Entra ID as the example; the steps are the same for any SAML 2.0 identity provider.
Before you begin
Section titled “Before you begin”- Identity server 1.68 or later,
awctl0.22 or later, and Terraform provider 0.23 or later. Earlier identity servers send a request that Microsoft Entra ID refuses; see Test the connection. - A tenant administrator seat, or a service account holding
tenant.admin. - A realm and an issuer that routes to it. See Realms and Domains and issuers.
- Rights on the identity provider side to create an enterprise application and assign people to it.
How it works
Section titled “How it works”A SAML connection is a two-way exchange of metadata:
- You create the provider in Authwise, which gives you Authwise’s service provider details: its entity ID and its assertion consumer service URL.
- You create the application on the identity provider’s side with those details, and download its metadata.
- You import that metadata into the provider in Authwise.
When a person signs in, Authwise sends an authentication request to the identity provider’s single sign-on URL. The identity provider signs the person in and posts a signed assertion back to Authwise’s assertion consumer service. Authwise checks the signature against the imported certificate, maps the assertion’s attributes to the account’s fields, and signs the person in.
SP-initiated and IdP-initiated sign-in
Section titled “SP-initiated and IdP-initiated sign-in”A SAML sign-in starts in one of two places.
SP-initiated. The person starts at an application that signs in with Authwise. Authwise sends an authentication request to the identity provider, and the identity provider’s response answers that request. This is the way every provider works, with nothing to turn on. It’s also the way to make the identity provider’s own portal work: give the identity provider the application’s sign-in URL, and its portal sends the person to the application, which starts the sign-in. In Microsoft Entra ID, that’s the Sign on URL in the application’s SAML configuration.
IdP-initiated. The person starts at the identity provider’s portal, and the identity provider posts an assertion that answers no request. Authwise accepts such an assertion only when Accept IdP-initiated logins is on, and only into a sign-in that is already in progress in the same browser: the person started at an application, Authwise sent them to the identity provider, and the assertion arrives at the provider’s assertion consumer service without the request’s ID. Authwise doesn’t start a sign-in from an assertion alone, because the assertion names no application to return the person to. A person who starts at the identity provider’s portal with no sign-in in progress sees an error.
Leave Accept IdP-initiated logins off unless a partner’s portal is the intended entry point. Matching a response to the request Authwise sent is what refuses a replayed or unsolicited response; with the setting on, only the signature check and the once-only check on the assertion’s ID stand in the way.
Create the provider
Section titled “Create the provider”-
Open the realm, go to Providers, and click New provider.
-
Click SAML 2.0.
-
In Display name, enter the label people see on the sign-in page, such as
Sign in with Entra ID. -
Click Create provider.
The console opens the provider’s page.
-
Under Our metadata, click Generate SP metadata and note Our entity ID and Assertion consumer service.
With awctl, in the realm’s context:
awctl identity providers create \ --display-name "Sign in with Entra ID" \ --provider-type saml \ --config '{"@type": "type.googleapis.com/authwise.types.core.v1alpha1.ProviderSaml", "wantAssertionsSigned": true}'awctl identity providers export-saml-metadata PROVIDER_IDReplace PROVIDER_ID with the provider’s ID (p-…). The export prints
the entity ID, the assertion consumer service URL, and the metadata XML.
When the tenant has several issuers, add
--issuer tenants/TENANT_ID/issuers/ISSUER_ID to name the one the
metadata is for.
Authwise’s details are built from the issuer’s hostname:
| Detail | Value |
|---|---|
| Entity ID | https://HOSTNAME/saml/sp/PROVIDER_ID |
| Assertion consumer service URL | https://HOSTNAME/saml/sp/PROVIDER_ID/callback, binding HTTP-POST |
| Metadata | https://HOSTNAME/saml/sp/PROVIDER_ID/metadata, readable without signing in |
Each hostname the issuer serves has its own entity ID. If the issuer also serves a hostname of your own, register that hostname’s entity ID and assertion consumer service URL on the identity provider as well. See Use your own domain.
Create the application in Microsoft Entra ID
Section titled “Create the application in Microsoft Entra ID”-
In the Microsoft Entra admin center, go to Enterprise applications and click New application, then Create your own application.
-
Enter a name, select Integrate any other application you don’t find in the gallery (Non-gallery), and click Create.
-
Go to Single sign-on and select SAML.
-
In Basic SAML Configuration, click Edit and enter:
- Identifier (Entity ID): Authwise’s entity ID.
- Reply URL (Assertion Consumer Service URL): Authwise’s assertion consumer service URL.
- Sign on URL: the URL of the application’s sign-in page, such as
https://app.example.com/login. With it set, the application’s tile in My Apps sends the person to the application, which starts an SP-initiated sign-in. Without it, the tile posts an IdP-initiated assertion, which Authwise refuses unless a sign-in is already in progress.
Leave Relay State and Logout Url empty, and click Save.
-
In Attributes & Claims, keep the default claims. Authwise reads the email address, given name, surname, and display name from Entra’s default claim names without any mapping. For Unique User Identifier (Name ID), choose the email address or the user principal name, with the format Email address.
-
In SAML Certificates, next to Federation Metadata XML, click Download.
-
In Users and groups, assign the people or groups who may sign in.
Import the identity provider’s metadata
Section titled “Import the identity provider’s metadata”-
On the provider’s page in the Authwise console, under Their SAML metadata, click Upload file and choose the downloaded XML, or paste its contents.
-
Click Check what this changes and review the entity ID, single sign-on URL, and signing certificate it found.
-
Click Apply import.
The import fills Entity ID, Single sign-on URL, and Single sign-on binding, and stores the signing certificate as a certificate of the tenant.
-
Check that Require signed assertions is on, and click Save.
The import turns it on. A provider with neither Require signed assertions nor Require a signed response turned on requires signed assertions. Identity server 1.56 to 1.67.0 refused every sign-in through such a provider instead; turn one of the two on there.
With awctl:
awctl identity providers import-saml-metadata PROVIDER_ID --file federation-metadata.xmlAdd --dry-run to see what the import would change without applying it.
With Terraform, import the certificate and set the identity provider’s details yourself:
resource "authwise_certificate" "entra_signing" { display_name = "Entra ID signing" use = "CERTIFICATE_USE_SIGNING" import_certificate_pem = file("${path.module}/entra-signing.crt")}
data "authwise_provider_saml" "entra" { idp_entity_id = "https://sts.windows.net/TENANT_GUID/" idp_sso_url = "https://login.microsoftonline.com/TENANT_GUID/saml2" idp_sso_binding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" idp_signing_certificate_id = authwise_certificate.entra_signing.certificate_id want_assertions_signed = true name_id_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}
resource "authwise_provider" "entra" { realm_id = authwise_realm.employees.realm_id display_name = "Sign in with Entra ID" provider_type = "saml" config = data.authwise_provider_saml.entra.any}Replace TENANT_GUID with the Entra tenant’s ID, and take the certificate
from the downloaded metadata’s X509Certificate element, wrapped in PEM
BEGIN CERTIFICATE and END CERTIFICATE lines. idp_sso_binding is the
SAML binding URN. Identity server 1.68 and provider 0.23 also accept the
short form HTTP-Redirect and store the URN; earlier versions accept the
short form and then refuse every sign-in.
The exchange takes two applies, because each side needs something the other side creates:
- Apply the provider without
idp_signing_certificate_id. Authwise’s entity ID and assertion consumer service URL contain the provider’s ID, so they exist only after this apply. A provider without the certificate refuses sign-ins until you set it. - Create the application in Entra ID with those two values, download its metadata, and take the certificate from it.
- Add the
authwise_certificateandidp_signing_certificate_id, and apply again.
Let the first sign-in create the account
Section titled “Let the first sign-in create the account”Open the realm’s Configuration and, in Provisioning, turn on Just-in-time federation. Without it, a person the realm doesn’t know yet is refused after the identity provider signs them in.
Test the connection
Section titled “Test the connection”-
Open the issuer’s sign-in page, such as
https://HOSTNAME/authorizethrough one of the issuer’s clients, or the sign-in of an application that uses it. -
If the realm has other sign-in methods, click the provider’s button. If the SAML provider is the realm’s only method, the page sends you to the identity provider at once.
-
Sign in at the identity provider.
You land back in the application, signed in. The realm’s Users page lists the new account.
If the identity provider refuses the request, the message on its page says why: most often the entity ID or reply URL doesn’t match what you registered, or the person isn’t assigned to the application. If Authwise refuses the response, it shows an error page with the reason, such as an assertion for a different audience or a signature it couldn’t verify.
Microsoft Entra ID reports these codes for a request from an identity server before 1.69.1. Upgrade; no setting on either side avoids them.
| Entra ID code | Cause |
|---|---|
AADSTS7500510 | The request’s IssueInstant carried nanoseconds, which Entra ID doesn’t parse. Identity server 1.68 sends whole seconds. |
AADSTS75011 | The request asked for a password sign-in (PasswordProtectedTransport) and the person signed in to Entra ID another way, such as passwordless or an existing session with multifactor authentication. Identity server 1.68 requests no authentication context. |
AADSTS900236 | The request named the person in a Subject element, which Entra ID doesn’t accept. Identity server 1.69.1 sends no Subject; it passes the person’s identifier as a login_hint query parameter instead. See How the person’s identifier reaches the identity provider. |
How the person’s identifier reaches the identity provider
Section titled “How the person’s identifier reaches the identity provider”When a sign-in is routed by email domain
or the application passes a login_hint, Authwise already knows the
person’s identifier when it sends them to the identity provider. It
passes the identifier along so the person doesn’t type it twice.
By default, Authwise adds the identifier to the identity provider’s
single sign-on URL as a login_hint query parameter. Microsoft Entra ID,
Google Workspace, and Okta read this parameter and pre-fill the account.
The request itself carries no Subject element, because Entra ID
refuses one and Google Workspace ignores it.
For an identity provider that reads the Subject element instead, or one
that must receive nothing, set identifier_hint on the provider. The
provider’s page has no field for it yet; set it in Terraform on
data.authwise_provider_saml (provider 0.24.0 or later), or in the JSON
you pass to awctl identity providers update --config (awctl 0.30.0 or
later). Identity server 1.70.0 or later.
identifier_hint | What Authwise sends |
|---|---|
LOGIN_HINT_QUERY | The identifier as a login_hint query parameter on the single sign-on URL. Default. |
SUBJECT | The identifier as the request’s Subject NameID, in the requested NameID format. Entra ID refuses this with AADSTS900236. |
NONE | Nothing. The person types their identifier at the identity provider. |
To ask the identity provider for a particular authentication method, set
requested_authn_context with a comparison of exact, minimum,
better, or maximum, and at least one class_refs entry, such as
urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport.
Leave it unset unless the identity provider documents that it needs one:
Entra ID requires exact and fails a sign-in that doesn’t match, as the
AADSTS75011 row shows.
data "authwise_provider_saml" "entra" { # ... identifier_hint = "LOGIN_HINT_QUERY"}Settings reference
Section titled “Settings reference”The provider’s page has these settings. The defaults suit Microsoft Entra ID and most other identity providers.
| Setting | What it does | Default |
|---|---|---|
| Entity ID, Single sign-on URL, Single sign-on binding | The identity provider’s identity and where Authwise sends the authentication request. The binding is a SAML binding URN; Authwise sends the request by HTTP-Redirect only, so the value is urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect. | Filled by the import |
| Their signing certificate | The certificate Authwise checks assertions with. | Filled by the import |
| Require signed assertions | Refuse an assertion that isn’t signed. Turn it on. | Off |
| Require a signed response | Refuse a response that isn’t signed. Some identity providers sign the response instead of the assertion. | Off |
| Sign AuthnRequests | Sign the request Authwise sends. Needs Our signing certificate, minted on the tenant’s Certificates page. The import turns it on when the identity provider’s metadata asks for signed requests. | Off |
| Our signing certificate | The certificate Authwise signs requests with and decrypts assertions with. | None |
| Requested NameID format | The identifier format Authwise asks for: Email address, Persistent, Transient, Unspecified, or Not requested. | Unspecified |
| Allow create | Tell the identity provider it may create an identifier for a person it hasn’t seen. | Off |
| Accept IdP-initiated logins | Accept an assertion the identity provider sends without a request from Authwise, into a sign-in already in progress. See SP-initiated and IdP-initiated sign-in. | Off |
| Accept SHA-1 signatures | For an identity provider that can’t sign with SHA-256. | Off |
| Clock skew tolerance (seconds) | How far the assertion’s timestamps may differ from Authwise’s clock. | 120 |
Identity and attribute mapping
Section titled “Identity and attribute mapping”The Identity section says which part of the assertion identifies the person and which attributes fill the account.
Identifier source (identifier_source) names the part of the
assertion that becomes the person’s identifier in Authwise. It takes one
of two forms:
| Value | Use it when |
|---|---|
assertion.name_id | The identity provider’s NameID is stable and meaningful, such as an email address or a persistent identifier. Default. |
assertion.attributes.NAME | The NameID is transient or opaque and an attribute carries the identifier instead, such as assertion.attributes.http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress. |
Choose it before the first sign-in. Authwise links each account to the identifier it saw first, so changing the source later makes existing people look new.
The attribute mapping defaults to the claim names Microsoft Entra ID sends:
| Account field | Assertion attribute |
|---|---|
email | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress |
given_name | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname |
family_name | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname |
display_name | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name |
preferred_username | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn |
To map an attribute yourself, add a row under Attribute mapping with
the account field and the source assertion.attributes.NAME, where NAME
is the attribute’s name in the assertion. Add [] after the name to take
every value of a multi-valued attribute. A mapping you set replaces the
defaults, so include every field you need. A SAML assertion has no way to
say an address is verified, so by default the address is kept as stated
and the person proves it the first time they use it. To count the
addresses of the directory’s own domains as verified, see
Trust what an identity provider says.
Trust the identity provider’s statements
Section titled “Trust the identity provider’s statements”Under Advanced, the Trust in the upstream row decides whether the identity provider’s statements count in Authwise. Trust the upstream’s authentication methods with Upstream level mapping lets a second factor the identity provider enforced count as one in Authwise, so the person isn’t asked twice. Trusted email domains with Count the upstream’s email as verified lets the addresses of the directory’s own domains count as verified. All are off by default and need identity server 1.98.0 or later on a SAML provider. See Trust what an identity provider says for what each costs and the values for Microsoft Entra ID.
What’s next
Section titled “What’s next”- Route sign-ins by email domain: send the organization’s email domain straight to this provider, so its people never see a password field.
- Trust what an identity provider says: count the identity provider’s second factor and its verified addresses.
- Realms: the realm’s other settings.