Context7 On-Premise connects to Active Directory Federation Services (ADFS) through its SAML 2.0 provider. You add Context7 as a relying party trust in ADFS, send four claims, and import the ADFS metadata in Context7. Context7 reads the standard ADFS claim types, so you do not need to map attributes by hand.
This page gives the ADFS-specific steps. For the full field reference, see SAML SSO.
Before you start#
You need:
- An ADFS admin who can add relying party trusts in the AD FS Management console.
- A running Context7 On-Premise instance, served over HTTPS at the address your users will open.
- A Context7 admin account. On a fresh install it is
admin/adminuntil you change it. - The Active Directory groups that will get the Context7 admin and member roles, for example
Context7-AdminsandContext7-Users.
Context7 builds its SAML URLs from the address it is reached at. Behind a reverse proxy, the proxy must send the X-Forwarded-Proto and X-Forwarded-Host headers with your public scheme and host. Otherwise sign-in fails.
Part 1: Add Context7 to ADFS#
- In Context7, open Workspace Settings › Authentication. In the Single sign-on card, select the SAML 2.0 tab. In the Service provider section, click Download metadata.
- In AD FS Management, right-click Relying Party Trusts and click Add Relying Party Trust. Select Claims aware.
- Select Import data about the relying party from a file and select the Context7 metadata file. If ADFS can reach Context7, you can use Import data about the relying party published online with the SP metadata URL instead.
- Enter
Context7as the display name. Select an access control policy, for example Permit everyone, and finish the wizard.
The metadata sets the identifier, the Assertion Consumer Service URL, the logout URL and the Context7 certificates. ADFS signs and encrypts the assertion by default. Context7 accepts both, so keep the defaults.
Part 2: Add the claim rules#
Right-click the new Context7 trust and click Edit Claim Issuance Policy. Add two rules.
Rule 1: Send LDAP attributes as claims
Click Add Rule, select Send LDAP Attributes as Claims, name it Context7 attributes, and select Active Directory as the attribute store. Add these rows:
| LDAP attribute | Outgoing claim type |
|---|---|
| E-Mail-Addresses | E-Mail Address |
| Given-Name | Given Name |
| Surname | Surname |
| Token-Groups - Unqualified Names | Role |
The Role claim carries the user’s group names, such as Context7-Admins. Context7 reads it as the groups attribute.
Rule 2: Send the NameID
Click Add Rule, select Transform an Incoming Claim, and name it Context7 NameID. Set:
- Incoming claim type: E-Mail Address
- Outgoing claim type: Name ID
- Outgoing name ID format: Email
Context7 recognizes returning users by the NameID. Without this rule, ADFS sends no NameID and sign-in fails.
Choose the NameID source before your users sign in, and do not change it later. If the NameID changes, Context7 creates a new user record for each person on their next sign-in.
Part 3: Configure Context7#
Import the ADFS metadata
Turn on Enable SAML 2.0. In IdP metadata URL, enter:
Click Import. Context7 fills in the IdP entity ID, the sign-in and logout URLs, and the ADFS token-signing certificates.
If the import fails because Context7 cannot reach ADFS or does not trust its certificate, open the metadata URL in your browser, click Paste XML in Context7, and paste the file. To trust an internal CA for all outbound HTTPS, set NODE_EXTRA_CA_CERTS on the server (see configuration).
Map groups to roles
Leave the attribute fields blank. Context7 detects the ADFS claims for email, name, username and groups.
- Admin group value: the AD group that gets the admin role, for example
Context7-Admins. - Member group value: the AD group that gets the member role, for example
Context7-Users.
Group values are case-sensitive. Users in neither group cannot sign in.
Test and save
Click Check configuration, then Save and apply. Open /login in a new browser window, click the SSO button, and sign in with an AD account in one of the groups.
On the first sign-in Context7 creates the user. On later sign-ins it updates the name, email, role and groups from ADFS.
Keep it running#
- Token-signing certificate rollover. When ADFS publishes a new token-signing certificate, open the SAML 2.0 tab and click Import again. Context7 does not reload the ADFS metadata by itself. If you import while ADFS publishes both the old and the new certificate, sign-in keeps working through the switch.
- Clocks. Context7 allows 60 seconds of clock difference with ADFS. Keep both servers on NTP.
- Removing a user. Disabling someone in Active Directory stops their next sign-in. It does not end browser sessions, MCP client authorizations or personal API keys. To end all access at once, also choose Disable sign-in for the user on the Members page. See Managing users.
Troubleshooting#
”SAML assertion has no NameID”#
Rule 2 is missing or its incoming claim is empty. Check that the user has an email address in Active Directory and that the rule sends it as the Name ID.
”This account is not assigned a supported Context7 group”#
The Role claim does not contain the admin or member group value. Check that rule 1 sends Token-Groups - Unqualified Names as Role, that the user is in the group, and that the value in Context7 matches the group name exactly.
”The SAML response signature could not be verified”#
Context7 does not have the current ADFS token-signing certificate. Click Import again.
For other errors, see SAML SSO troubleshooting, or contact context7@upstash.com.