Integrate with Bitwarden
Support level: Community
What is Bitwarden
Bitwarden is a freemium, open-source password management service that helps users store, manage, and share sensitive information securely online.
Preparation
The following placeholders are used in this guide:
authentik.company
is the FQDN of the authentik installation.bitwarden.company
is the FQDN of the Bitwarden installation (if using self-hosted Bitwarden).
This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application.
Configuration methods
You can configure Bitwarden to use either OIDC or SAML; this guide explains both options.
- Log in with OIDC
- Log in with SAML
authentik configuration
To support the integration of Bitwarden with authentik, you need to create a property mapping and an application/provider pair in authentik.
Create a property mapping
Bitwarden requires a first and last name for every user. However, authentik, by default, only supplies a full name as a single string. As a result, a property mapping must be created to separate and provide first and last names to Bitwarden.
-
Log in to authentik as an administrator, and open the authentik Admin interface.
-
Navigate to Customization > Property Mappings and click Create.
-
Select type: select Scope Mapping.
-
Configure the Scope Mapping: Provide a descriptive name (e.g.
Bitwarden Profile Scope
), and an optional description.- Scope name:
profile
- Expression:
return {
"name": request.user.name,
"preferred_username": request.user.username,
"nickname": request.user.username,
"groups": [group.name for group in request.user.ak_groups.all()],
"surname": request.user.name.rsplit(" ", 1)[-1],
"givenname": request.user.name.rsplit(" ", 1)[0],
} - Scope name:
-
-
Click Finish to save the property mapping.
Create an application and provider in authentik
-
Log in to authentik as an administrator, and open the authentik Admin interface.
-
Navigate to Applications > Applications and click Create with Provider to create an application and provider pair. (Alternatively you can first create a provider separately, then create the application and connect it with the provider.)
- Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings.
- Choose a Provider type: select OAuth2/OpenID Connect as the provider type.
- Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
- Note the Client ID, Client Secret, and slug values because they will be required later.
- Set a
Strict
redirect URI to:https://sso.bitwarden.com/oidc-signin
for Non-EU based SaaS Bitwarden.https://sso.bitwarden.eu/oidc-signin
for EU based SaaS Bitwarden.https://bitwarden.company/oidc-signin
for self-hosted Bitwarden.
- Select any available signing key.
- Under Advanced protocol settings, Selected Scopes:
- Remove
authentik default OAuth Mapping: OpenID 'profile'
and add the property mapping that you created.
- Remove
- Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's My applications page.
-
Click Submit to save the new application and provider.
Bitwarden configuration
-
Log in to the Bitwarden dashboard as an administrator (choose
Accessing: bitwarden.eu
for Bitwarden accounts based in the EU). If you are using a self-hosted Bitwarden, go tohttps://bitwarden.company/#/login
. -
In the sidebar, navigate to Admin Console > Settings > Single sign-on, and enter the following settings:
- Allow SSO authentication: Select this option.
- SSO Identifier: enter a globally unique SSO identifier (this is not required if using self-hosted Bitwarden, or if you have claimed a domain, see the Bitwarden Claimed Domains documentation).
- Type:
OIDC
- Under OpenID connect configuration:
- Authority:
https://authentik.company/application/o/<application_slug>/
- Client ID: Client ID from authentik.
- Client secret: Client secret from authentik.
- Metadata address:
https://authentik.company/application/o/<application_slug>/.well-known/openid-configuration
- OIDC redirect behavior:
Redirect GET
- Get claims from user info endpoint: Select this option.
- Authority:
-
Click Save.
authentik configuration
To support the integration of Bitwarden with authentik, you need to create an application/provider pair in authentik.
Create an application and provider in authentik
-
Log in to authentik as an administrator, and open the authentik Admin interface.
-
Navigate to Applications > Applications and click Create with Provider to create an application and provider pair. (Alternatively you can first create a provider separately, then create the application and connect it with the provider.)
- Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings. Take note of the slug as it will be required later.
- Choose a Provider type: select SAML Provider as the provider type.
- Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
- Temporarily set the ACS URL to
https://temp.temp
- Under Advanced protocol settings, set Signing Certificate to use any available certificate.
- Temporarily set the ACS URL to
- Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's My applications page.
-
Click Submit to save the new application and provider.
Download certificate file
- Navigate to Applications > Providers and click on the name of the provider that you created in the previous section (e.g.
Provider for Bitwarden
). - Navigate to Applications > Providers and click on the name of the provider that you created in the previous section (e.g.
Provider for bitwarden
). - Under Related objects > Download signing certificate, click on Download. This downloaded file is your certificate file and it will be required in the next section.
Bitwarden configuration
- Log in to the Bitwarden dashboard as an administrator (select
Accessing: bitwarden.eu
for EU based Bitwarden accounts). For self-hosted Bitwarden usehttps://bitwarden.company/#/login
. - In the sidebar, navigate to Admin Console > Settings > Single sign-on, and enter the following settings:
- Allow SSO authentication: Select this option.
- SSO Identifier: enter a globally unique SSO identifier (this is not required if using self-hosted Bitwarden, or if you have claimed a domain, see the Bitwarden Claimed Domains documentation).
- Type:
SAML 2.0
- Under SAML service provider configuration:
- Expect signed assertions: Select this option.
- Under SAML identity provider configuration:
- Entity ID:
authentik
- Single sign-on service URL:
https://authentik.company/application/saml/<application_slug>/sso/binding/redirect/
- Single log-out service URL:
https://authentik.company/application/saml/<application_slug>/slo/binding/redirect/
- X509 public certificate: Paste the contents of your certificate file.
- Entity ID:
- Under SAML service provider configuration, take note of the SP entity ID and Assertion consumer service (ACS) URL values. These will be required in the next section.
- Click Save.
Reconfigure authentik provider
- Log in to authentik as an administrator, and open the authentik Admin interface.
- Navigate to Applications > Providers and click the Edit icon of the newly created Bitwarden provider.
- Under Protocol settings, set the following required configurations:
- ACS URL: set to the Assertion consumer service (ACS) URL from Bitwarden.
- Audience: set to the SP entity ID from Bitwarden.
- Click Update
Configuration verification
To confirm that authentik is properly configured with Bitwarden, log out and go to the Bitwarden login page (select Accessing: bitwarden.eu
for EU based Bitwarden accounts or use https://bitwarden.company/#/login
for self-hosted Bitwarden).
Enter the email address of a Bitwarden account and click Use single sign-on. If you haven't claimed the email domain in Bitwarden, enter the unique SSO identifier that you selected, and click Continue. You should be redirected to authentik to login, once successful you should be redirected to the Bitwarden dashboard.
Depending on your Member decryption options
setting, which is set in Bitwarden via Admin Console > Settings > Single sign-on, you may still be required to enter your master password after signing in via SSO.