triauth for Apache SupersetOIDC
Let your analysts and their readers open Apache Superset with one approval on their own device, and no Superset passwords.
- Sign-in through
- OpenID Connect bridge
- Available in
- Every Apache Superset installation
- Set up in
superset_config.py
About Apache Superset
Apache Superset is a web application for exploring data and building charts and dashboards from company databases, without writing code for each chart. Analysts and business teams use it as a free alternative to commercial business intelligence tools, on servers of their own.
Connect Apache Superset to triauth
Superset signs people in through the triauth OpenID Connect bridge. Once connected, the login page shows a Sign In with triauth button. People on your team click it, type their username, and approve on their own device. Nobody keeps a Superset password, and when someone leaves, removing their identity records at your domain ends their access to Superset as well.
Superset takes its sign-in settings as a short piece of Python configuration rather than a settings page, so this one is for the person who runs your Superset.
How it works
Open oidc.triauth.org and enter your domain. Paste Superset's redirect address,
https://superset.example.com/oauth-authorized/triauthwith your own Superset address in place ofsuperset.example.com, and click Connect app. The bridge gives you a client ID and a client secret.Add the settings below to
superset_config.py, with your domain in place ofexample.comand the two placeholders replaced by the client ID and the client secret from the bridge. The Authlib package must be installed next to Superset.pythonfrom flask_appbuilder.security.manager import AUTH_OAUTH from custom_sso_security_manager import CustomSsoSecurityManager AUTH_TYPE = AUTH_OAUTH AUTH_USER_REGISTRATION = True AUTH_USER_REGISTRATION_ROLE = "Gamma" CUSTOM_SECURITY_MANAGER = CustomSsoSecurityManager OAUTH_PROVIDERS = [{ "name": "triauth", "icon": "fa-key", "token_key": "access_token", "remote_app": { "client_id": "<client ID from the bridge>", "client_secret": "<client secret from the bridge>", "server_metadata_url": "https://oidc.triauth.org/example.com/.well-known/openid-configuration", "client_kwargs": {"scope": "openid email profile groups", "code_challenge_method": "S256"}, }, }]Next to it, create
custom_sso_security_manager.py, which tells Superset which fields of the sign-in to use. It follows the shape of the Keycloak example in Superset's own guide.pythonfrom superset.security import SupersetSecurityManager class CustomSsoSecurityManager(SupersetSecurityManager): def oauth_user_info(self, provider, response=None): me = self.oauth_remotes[provider].get("https://oidc.triauth.org/example.com/userinfo").json() return { "username": me.get("email"), "email": me.get("email"), "first_name": me.get("name", ""), "last_name": "", "role_keys": me.get("groups", []), }Restart Superset.
Open Superset's login page and click Sign In with triauth.
Checkpoint
Superset's login page shows a Sign In with triauth button. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve.
Good to know
- Everyone with an identity at your domain gets a Superset account the first time they sign in, with the role named in the settings. To let only one team in, limit the app to a group when you connect it.
AUTH_ROLES_MAPPINGturns the groups published at your domain into Superset roles, andAUTH_ROLES_SYNC_AT_LOGIN = Truekeeps them in step at every sign-in.- People who already have a Superset account keep it when their Superset username is their identifier.
For the person who connects the app
| Setting | Value |
|---|---|
| Redirect address | https://<your-superset>/oauth-authorized/<provider name>, with the name from OAUTH_PROVIDERS |
| Where in Superset | superset_config.py and a small security manager class next to it |
| Discovery | server_metadata_url takes the full address, https://oidc.triauth.org/<your domain>/.well-known/openid-configuration |
| PKCE | code_challenge_method: S256 in client_kwargs, as above |
| Roles | AUTH_ROLES_MAPPING = {"admins@example.com": ["Admin"]}, with the group's full name including the domain with AUTH_ROLES_SYNC_AT_LOGIN = True |
Superset keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. Superset's OAuth guide shows a complete example with group mapping, and the configuration reference describes every option.
Next steps
- Read the OpenID Connect bridge page for what every connected app gets and what the bridge keeps private.
- Read Roll out to your team to give everyone in your organization an identifier at your domain.
- Read Groups to publish teams and map them to Superset roles.
- Read Superset's OAuth guide for every setting Superset offers.
All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.