This repository has been archived on 2023-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
dex/Documentation/connectors/bitbucketcloud.md

35 lines
1.9 KiB
Markdown
Raw Normal View History

2018-09-30 19:08:07 +00:00
# Authentication through Bitbucket Cloud
## Overview
One of the login options for dex uses the Bitbucket OAuth2 flow to identify the end user through their Bitbucket account.
When a client redeems a refresh token through dex, dex will re-query Bitbucket to update user information in the ID Token. To do this, __dex stores a readonly Bitbucket access token in its backing datastore.__ Users that reject dex's access through Bitbucket will also revoke all dex clients which authenticated them through Bitbucket.
## Configuration
Register a new OAuth consumer with [Bitbucket](https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html) ensuring the callback URL is `(dex issuer)/callback`. For example if dex is listening at the non-root path `https://auth.example.com/dex` the callback would be `https://auth.example.com/dex/callback`.
The application requires the user to grant the `Read Account` and `Read Team membership` permissions. The latter is required only if group membership is a desired claim.
2018-09-30 19:08:07 +00:00
The following is an example of a configuration for `examples/config-dev.yaml`:
```yaml
connectors:
2018-10-04 16:29:36 +00:00
- type: bitbucket-cloud
2018-09-30 19:08:07 +00:00
# Required field for connector id.
2018-10-06 15:45:56 +00:00
id: bitbucket-cloud
2018-09-30 19:08:07 +00:00
# Required field for connector name.
2018-10-06 15:45:56 +00:00
name: Bitbucket Cloud
2018-09-30 19:08:07 +00:00
config:
# Credentials can be string literals or pulled from the environment.
clientID: $BITBUCKET_CLIENT_ID
2018-10-04 16:29:36 +00:00
clientSecret: $BITBUCKET_CLIENT_SECRET
2018-09-30 19:08:07 +00:00
redirectURI: http://127.0.0.1:5556/dex/callback
2018-10-04 16:29:36 +00:00
# Optional teams whitelist, communicated through the "groups" scope.
# If `teams` is omitted, all of the user's Bitbucket teams are returned when the groups scope is present.
# If `teams` is provided, this acts as a whitelist - only the user's Bitbucket teams that are in the configured `teams` below will go into the groups claim. Conversely, if the user is not in any of the configured `teams`, the user will not be authenticated.
2018-09-30 19:08:07 +00:00
teams:
- my-team
```