> ## Documentation Index
> Fetch the complete documentation index at: https://docs.barndoor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your IdP

> Set up SSO login and automatically provision user roles using any OIDC / SAML 2.0 compatible IdP

## Overview

This guide demonstrates how to integrate an Identity Provider (IdP) such as Okta or Entra ID with Barndoor to enable:

* **SSO Login**: Allow all users in your organization to authenticate via your IdP
* **Automatic Role Mapping**: Provision users as admins or standard users based on IdP group membership
* **Centralized User Management**: Onboard and offboard users directly from your IdP

Barndoor works with any OIDC or SAML 2.0 compatible IdP. If you use Okta or Microsoft Entra ID, follow the dedicated provider guide below for screenshots and provider-specific gotchas. Otherwise, use the generic flow on this page.

## Choose your provider

<CardGroup cols={3}>
  <Card title="Okta (custom app)" icon="key" href="/how-tos/okta-custom-app-setup">
    Manual Okta OIDC app registration, groups claim filter, and role mapping.
  </Card>

  <Card title="Okta (OIN)" icon="store" href="/how-tos/okta-oin-setup">
    Official Okta Integration Network app with SCIM provisioning.
  </Card>

  <Card title="Microsoft Entra ID" icon="microsoft" href="/how-tos/entra-idp-setup">
    Entra (Azure AD) app registration, issuer URL gotcha, and group claims.
  </Card>
</CardGroup>

<Info>
  Using a different IdP (Google Workspace, JumpCloud, OneLogin, Ping, etc.)? The generic OIDC / SAML 2.0 flow below applies to all of them.
</Info>

## Video Walkthrough

<div
  style={{
width: "100%",
maxWidth: "1100px",
margin: "2rem auto",
borderRadius: "12px",
overflow: "hidden"
}}
>
  <div style={{ position: "relative", paddingTop: "56.25%" }}>
    <iframe
      src="https://fast.wistia.net/embed/iframe/57a4lzi4ju?seo=false&videoFoam=true"
      title="Connecting Accounts Demo"
      allow="autoplay; fullscreen"
      frameBorder="0"
      scrolling="no"
      style={{
    position: "absolute",
    top: 0,
    left: 0,
    width: "100%",
    height: "100%",
    border: "none"
  }}
    />
  </div>
</div>

<Note>
  **Prerequisites**:

  * Admin access to your Barndoor account
  * Admin access to your IdP (Okta, Entra, etc.)
  * An IdP application configured with OIDC/OAuth or SAML 2.0
</Note>

## How it works

At a high level, connecting any IdP follows the same stages:

1. **Configure the connection** in Barndoor with your IdP's Issuer URL, Client ID, and Client Secret.
2. **Verify SSO login** works for a standard user.
3. **Configure role mapping** so IdP group membership provisions Barndoor admins automatically.
4. **Test offboarding** by removing a user from the admin group.
5. **(Optional) Enforce organization-wide SSO** and configure a break-glass emergency administrator.
6. **(Optional) Remove the SSO connection** when you need to disconnect.

The rest of this page walks through each stage generically. For provider-specific UI and screenshots, use the [Okta custom app](/how-tos/okta-custom-app-setup), [Okta OIN](/how-tos/okta-oin-setup), or [Entra ID](/how-tos/entra-idp-setup) guides above.

***

## Step 1: Configure IdP Connection in Barndoor

<Steps>
  <Step title="Navigate to Identity Provider Settings">
    Go [here](https://app.barndoor.ai/idp) in your Barndoor dashboard.
  </Step>

  <Step title="Complete IdP Setup Form">
    * Provide a display name, such as your domain name.
      From your IdP application collect:
    * **Issuer URL**: Your organization's Issuer URL
    * **Client ID**: OAuth client ID from your IdP app
    * **Client Secret**: OAuth client secret from your IdP app
      <Tip>Auto discover will prefill your Authorization, Token, User Info, JWKS, and Logout URLs. If they are not autodiscovered, enter them manually.</Tip>
  </Step>

  <Step title="Test the Connection">
    Click **Test Connection** to verify that Barndoor can communicate with your IdP.

    ✅ **Expected result**: "Connection successful" message
  </Step>

  <Step title="Save Configuration">
    Click **Save** to activate the IdP connection.
  </Step>
</Steps>

***

## Step 2: Verify SSO Login Works

<Steps>
  <Step title="Log Out of Barndoor">
    Sign out of your current Barndoor session.
  </Step>

  <Step title="Attempt Login with Enterprise User">
    Try logging in with the enterprise test user from Step 1 using a user's email connected to your IdP.

    You should now be redirected to your IdP's login page.
  </Step>

  <Step title="Authenticate via IdP">
    Complete authentication through your IdP (enter credentials, complete MFA if required).
  </Step>

  <Step title="Verify Access to Barndoor">
    After successful IdP authentication, you should be logged into Barndoor.

    ✅ **Expected result**: User is logged in but has **standard user** permissions (not admin yet).
  </Step>
</Steps>

<Check>
  SSO is now working! Users can authenticate via your IdP.
</Check>

***

## Step 3: Configure Role Mapping (Auto-Provision Admins)

Now we'll set up automatic role assignment based on IdP group membership.

### Create Admin Group in IdP

<Steps>
  <Step title="Navigate to Groups in IdP">
    In your IdP (Okta/Entra ID), go to **Directory** → **Groups**.
  </Step>

  <Step title="Create or Select Admin Group">
    Create a new group called **"Barndoor Admins"** (or use an existing admin group).
  </Step>

  <Step title="Assign Users to Admin Group">
    Add the test user to the **Barndoor Admins** group.

    💡 **Note**: Any user in this group will automatically receive admin permissions in Barndoor.
  </Step>
</Steps>

### Send IdP Groups to Barndoor

Barndoor can only map roles and evaluate group-based policies when your IdP sends group names during login. For OIDC connections, include a claim named exactly `groups` in the ID token or UserInfo response.

<Warning>
  Role mappings are synced on login. If the mapped group claim is missing or does not match exactly, the corresponding Barndoor role can be removed the next time the user signs in.
</Warning>

<Steps>
  <Step title="Configure the groups claim">
    In your IdP application, add a groups claim with:

    * **Claim name**: `groups`
    * **Claim values**: Group display names, not group IDs
    * **Included groups**: At minimum, the group you want to map to Barndoor admin access, such as `Barndoor Admins`
  </Step>

  <Step title="Use your provider's exact steps">
    The way you emit the `groups` claim differs per IdP. Follow the dedicated guide for the precise UI:

    * **Okta**: [add a groups claim filter](/how-tos/okta-custom-app-setup#step-3-configure-role-mapping-auto-provision-admins)
    * **Entra ID**: [add a groups claim and set the group identifier](/how-tos/entra-idp-setup#step-3-add-the-groups-claim)
  </Step>

  <Step title="Verify the emitted claim">
    Use your IdP's token preview, logs, or a fresh test login to confirm the token or UserInfo response contains `groups` with the exact group name you will configure in Barndoor.
  </Step>
</Steps>

### Map IdP Group to Barndoor Admin Role

<Steps>
  <Step title="Open Map groups to roles">
    On the [Identity Provider](https://app.barndoor.ai/idp) page, open the **Map groups to roles** card for your SSO connection.
  </Step>

  <Step title="Configure Admin Group Mapping">
    Set the group name that defines administrators:

    * **Admin Role Group Name**: Enter `Barndoor Admins` (exact name from your IdP)
    * Optionally enable **IdP-Only Role Binding** so roles can only be assigned through IdP group mappings (recommended for production SSO rollouts)
  </Step>

  <Step title="Save Role Mapping">
    Click **Save Role Settings**.

    ✅ **Expected result**: Role mapping saved successfully
  </Step>
</Steps>

### Verify Role Provisioning

<Steps>
  <Step title="Log Out and Back In">
    Sign out of Barndoor and log back in with the test user.
  </Step>

  <Step title="Verify Admin Access">
    After logging in, confirm:

    * ✅ User now has **Admin** role
    * ✅ Additional admin functionality is visible in the UI
    * ✅ User appears in the **Barndoor Admins** user group
  </Step>
</Steps>

<Check>
  Role mapping is working! Users in the IdP admin group automatically receive admin permissions.
</Check>

***

## Step 4: Test User Offboarding (Remove Admin Access)

<Steps>
  <Step title="Remove User from Admin Group in IdP">
    In your IdP, go to **Directory** → **Groups** → **Barndoor Admins**.

    Remove the test user from the **Barndoor Admins** group.
  </Step>

  <Step title="Log Out and Back In">
    In Barndoor, sign out and log back in with the test user.
  </Step>

  <Step title="Verify Standard User Access">
    Confirm that:

    * ✅ User is now a **standard user** (no longer admin)
    * ✅ Admin-only functionality is no longer visible
    * ✅ User group reflects the change
  </Step>
</Steps>

<Info>
  Changes to IdP group membership are reflected immediately upon next login to Barndoor.
</Info>

***

## Roll out SSO enforcement

After your IdP connection is saved and SSO sign-in works, the **Roll out SSO enforcement** section on the [Identity Provider](https://app.barndoor.ai/idp) page lets you require SSO for every member of your organization. Until you enforce SSO, users can still sign in with Barndoor passwords in addition to your IdP.

<Info>
  If you don't see **Roll out SSO enforcement** controls on the Identity Provider page, organization-wide SSO enforcement may not be enabled for your workspace yet. Contact your Barndoor account team.
</Info>

<Warning>
  **Enforcing SSO is irreversible in production.** It permanently clears Barndoor passwords for all members, terminates every active session (including yours), and requires all future logins through your IdP—except the dedicated break-glass account described below.
</Warning>

### What changes when you enforce SSO

When you confirm enforcement, Barndoor:

* Requires all organization members to sign in through your IdP
* Permanently clears saved Barndoor passwords for every member
* Leaves password sign-in enabled **only** for the break-glass admin email you configure
* Terminates all active sessions, including the administrator who enabled enforcement

After enforcement succeeds, sign out and sign back in through your IdP to continue working as an administrator.

### Prerequisites

Both items in **Before you can enforce SSO** must be complete before **Enforce SSO** is enabled:

<Steps>
  <Step title="Test SSO sign-in">
    Click **Test SSO sign-in**. Barndoor opens a pop-up window and runs the full IdP login path—not just a connection preflight.

    Complete authentication in the pop-up. When the test succeeds, the row is marked complete. You can run the test again anytime to confirm sign-in still works.

    <Tip>
      If the pop-up is blocked, allow pop-ups for the Barndoor site and run the test again.
    </Tip>
  </Step>

  <Step title="Configure break-glass admin email">
    Click **Manage** on the **Break-glass admin email** row and set an emergency mailbox your security or platform team can use if your IdP is unavailable.

    * The address must use your organization's IdP email domain (shown as `@your-domain` in the dialog)
    * It must **not** already belong to an existing Barndoor user
    * You **cannot** use your own administrator email as the break-glass account

    Click **Save**. Barndoor stores the address as the configured break-glass email. The dedicated break-glass user account is created when you enforce SSO.
  </Step>
</Steps>

### Enable organization-wide SSO

<Steps>
  <Step title="Review the rollout card">
    When both prerequisites are complete, click **Enforce SSO** at the bottom of the rollout card.
  </Step>

  <Step title="Acknowledge each consequence">
    In the confirmation dialog, check every acknowledgement:

    * Future logins will be exclusively via IdP SSO
    * All Barndoor passwords will be permanently cleared
    * Only your break-glass email will be able to sign in via password going forward
    * All active sessions—including your current one—will be terminated

    The dialog also shows your IdP connection name and redirect URI for a final sanity check.
  </Step>

  <Step title="Confirm enforcement">
    Click **Confirm Enforcement**. On success, Barndoor shows **SSO enforcement is active** and prompts you to **Sign out and sign in with SSO**.

    <Note>
      If enforcement succeeds but Barndoor shows a warning that not all member passwords were cleared or sessions could not be terminated, SSO enforcement is still active. Sign out and sign in again with SSO, verify member access, and contact support if the warning persists.
    </Note>
  </Step>
</Steps>

<Check>
  SSO enforcement is active. All organization members must sign in through your Identity Provider. Password login is disabled for everyone except the break-glass account.
</Check>

### Set up the break-glass account

When enforcement completes, Barndoor provisions a dedicated **Barndoor Break Glass** administrator account at the email you configured and sends a setup email to that mailbox. The recipient must:

1. Open the setup email and follow the link to set a password
2. At first sign-in, complete the email one-time passcode (OTP) sent to that mailbox—the same second factor used during an IdP outage

Store break-glass credentials in your organization's secure emergency-access process (for example, a sealed envelope or privileged-access vault)—not in shared chat or email threads.

### Manage break-glass access after enforcement

After SSO is enforced, the rollout card shows **SSO enforcement** as active and lets you manage the break-glass email:

* **Resend invite** — If the break-glass account has not finished password setup, resend the setup email from the break-glass dialog
* **Change break-glass email** — Opens a destructive change flow. Enter the new address, check the acknowledgement that the current account will lose password sign-in, then click **Save**. The new mailbox must complete password and OTP setup before it can be used

<Warning>
  Changing the break-glass email while SSO is enforced removes the previous break-glass account's password credentials and requires the new mailbox to complete setup from scratch.
</Warning>

### Sign in with break-glass during an IdP outage

If your IdP is unavailable and you need emergency administrator access:

1. On the Barndoor sign-in page, choose password sign-in (not SSO)
2. Enter the break-glass email address and password
3. Complete the email one-time passcode sent to that mailbox

Password sign-in and email OTP at login are available **only** for the break-glass account once SSO is enforced. All other members must use IdP SSO.

### Remove the SSO connection (optional)

To disconnect IdP integration before or after enforcement, open the **actions menu** (⋯) on the rollout card and choose **Remove SSO**. Confirm when prompted.

<Warning>
  Removing the SSO connection immediately revokes IdP-based access for your organization. Only users who can still authenticate with a Barndoor password—including the break-glass account, if configured—can sign in. SSO enforcement remains on for the organization; re-connecting an IdP does not restore member password login.
</Warning>

### SSO enforcement troubleshooting

<AccordionGroup>
  <Accordion title="Test SSO sign-in pop-up blocked or closes early" icon="window-restore">
    **Common causes:**

    * Browser blocked pop-ups for the Barndoor site
    * The sign-in window was closed before authentication finished

    **Solution:** Allow pop-ups for your Barndoor portal origin, then click **Test SSO sign-in** again. If the test times out, cancel and retry.
  </Accordion>

  <Accordion title="Break-glass email rejected on Save" icon="envelope">
    **Common causes:**

    * Address is outside your organization's IdP email domain
    * Address already belongs to an existing Barndoor user
    * You entered your own administrator email

    **Solution:** Use a dedicated emergency mailbox on your IdP domain that is not yet a Barndoor user. Enter only the part before `@`—the domain is shown in the dialog.
  </Accordion>

  <Accordion title="Break-glass setup email not received" icon="paper-plane">
    **Solution:** From the break-glass **Manage** dialog after enforcement, click **Resend invite**. Check spam filters and confirm the mailbox is monitored. The recipient must complete password setup from the link before the account can sign in.
  </Accordion>

  <Accordion title="Enforcement succeeded with a warning" icon="triangle-exclamation">
    **Cause:** SSO enforcement is active, but Barndoor could not clear every member password or terminate every session.

    **Solution:** Sign out and sign back in with SSO. Verify affected members can still reach the app through your IdP. Contact Barndoor support if the warning remains or members report unexpected password login.
  </Accordion>
</AccordionGroup>

***

## Summary

You've successfully configured IdP integration with Barndoor! Here's what you accomplished:

✅ **Connected IdP** for SSO/OIDC authentication\
✅ **Enabled automatic role provisioning** based on IdP groups\
✅ **Tested user onboarding** (SSO login and admin access)\
✅ **Tested user offboarding** (removed admin access via IdP)\
✅ **(Optional) Enforced organization-wide SSO** with a break-glass emergency account

### Key Benefits

**Centralized authentication**: Users log in via your existing IdP
**Automated role management**: No manual user provisioning needed
**Streamlined onboarding**: New employees automatically get access
**Instant offboarding**: Removing users from IdP immediately revokes access

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="SSO Login Redirects but Fails" icon="circle-xmark">
    **Common causes:**

    * Incorrect Client ID or Client Secret
    * IdP application not configured with correct redirect URIs
    * OIDC endpoints not properly discovered
    * domain mismatch

    **Solution**: Double-check credentials in both Barndoor and your IdP. Re-test the connection and review IdP application logs.
  </Accordion>

  <Accordion title="Role Mapping Not Working" icon="user-slash">
    **Common causes:**

    * Group name mismatch (case-sensitive)
    * User not actually in the IdP group
    * OIDC `groups` claim is missing from the ID token or UserInfo response
    * IdP sends group IDs, paths, or a different claim name instead of the group display name
    * Role mapping not saved properly

    **Solution**: Verify the exact group name in IdP matches Barndoor configuration. Confirm user membership in IdP groups. For OIDC, preview the token or UserInfo response and confirm it includes `groups` with the expected value, such as `Barndoor Admins`. Re-save role mapping settings and have the user sign out and back in.
  </Accordion>

  <Accordion title="Users Can't Access After IDP Connection">
    **Common causes:**

    * Users not assigned to the IdP application
    * IdP application deactivated or suspended
    * Network/firewall blocking communication

    **Solution**: Verify users are assigned to the Barndoor application in your IdP. Check IdP application status. Test connection from Barndoor settings.
  </Accordion>
</AccordionGroup>
