Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit e124a7a

Browse files
committed
Document all the upstream oauth2 provider options
1 parent 9bd46b5 commit e124a7a

File tree

1 file changed

+154
-17
lines changed

1 file changed

+154
-17
lines changed

docs/usage/configuration.md

Lines changed: 154 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ http:
4848
# List of addresses and ports to listen to
4949
binds:
5050
# First option: listen to the given address
51-
- address: '[::]:8080'
51+
- address: "[::]:8080"
5252

5353
# Second option: listen on the given host and port combination
5454
- host: localhost
@@ -78,8 +78,8 @@ http:
7878

7979
The following additional resources are available, although it is recommended to serve them on a separate listener, not exposed to the public internet:
8080

81-
- `name: prometheus`: serves the a Prometheus-compatible metrics endpoint on `/metrics`, if the Prometheus exporter is enabled in `telemetry.metrics.exporter`.
82-
- `name: health`: serves the health check endpoint on `/health`.
81+
- `name: prometheus`: serves the a Prometheus-compatible metrics endpoint on `/metrics`, if the Prometheus exporter is enabled in `telemetry.metrics.exporter`.
82+
- `name: health`: serves the health check endpoint on `/health`.
8383

8484
## `database`
8585

@@ -215,22 +215,21 @@ secrets:
215215
The service can use a number of key types for signing.
216216
The following key types are supported:
217217

218-
- RSA
219-
- ECDSA with the P-256 (`prime256v1`) curve
220-
- ECDSA with the P-384 (`secp384r1`) curve
221-
- ECDSA with the K-256 (`secp256k1`) curve
218+
- RSA
219+
- ECDSA with the P-256 (`prime256v1`) curve
220+
- ECDSA with the P-384 (`secp384r1`) curve
221+
- ECDSA with the K-256 (`secp256k1`) curve
222222

223223
Each entry must have a unique (and arbitrary) `kid`, plus the key itself.
224224
The key can either be specified inline (with the `key` property), or loaded from a file (with the `key_file` property).
225225
The following key formats are supported:
226226

227-
- PKCS#1 PEM or DER-encoded RSA private key
228-
- PKCS#8 PEM or DER-encoded RSA or ECDSA private key, encrypted or not
229-
- SEC1 PEM or DER-encoded ECDSA private key
227+
- PKCS#1 PEM or DER-encoded RSA private key
228+
- PKCS#8 PEM or DER-encoded RSA or ECDSA private key, encrypted or not
229+
- SEC1 PEM or DER-encoded ECDSA private key
230230

231231
For PKCS#8 encoded keys, the `password` or `password_file` properties can be used to decrypt the key.
232232

233-
234233
## `passwords`
235234

236235
Settings related to the local password database
@@ -240,7 +239,7 @@ passwords:
240239
# Whether to enable the password database.
241240
# If disabled, users will only be able to log in using upstream OIDC providers
242241
enabled: true
243-
242+
244243
# List of password hashing schemes being used
245244
# /!\ Only change this if you know what you're doing
246245
# TODO: document this section better
@@ -249,7 +248,6 @@ passwords:
249248
algorithm: argon2id
250249
```
251250

252-
253251
## `policy`
254252

255253
Policy settings
@@ -306,7 +304,7 @@ telemetry:
306304
# Export traces to an OTLP-compatible endpoint
307305
#exporter: otlp
308306
#endpoint: https://localhost:4317
309-
307+
310308
# Export traces to a Jaeger endpoint
311309
#exporter: jaeger
312310
#protocol: http/thrift.binary | udp/thrift.compact
@@ -323,7 +321,7 @@ telemetry:
323321
metrics:
324322
# The default: don't export metrics
325323
exporter: none
326-
324+
327325
# Export metrics to an OTLP-compatible endpoint
328326
#exporter: otlp
329327
#endpoint: https://localhost:4317
@@ -345,7 +343,7 @@ Settings related to sending emails
345343
email:
346344
from: '"The almighty auth service" <[email protected]>'
347345
reply_to: '"No reply" <[email protected]>'
348-
346+
349347
# Default transport: don't send any emails
350348
transport: blackhole
351349
@@ -356,7 +354,7 @@ email:
356354
#port: 587
357355
#username: username
358356
#password: password
359-
357+
360358
# Send emails by calling a local sendmail binary
361359
#transport: sendmail
362360
#command: /usr/sbin/sendmail
@@ -365,3 +363,142 @@ email:
365363
# This uses the AWS SDK, so the usual AWS environment variables are supported
366364
#transport: aws_ses
367365
```
366+
367+
### `upstream_oauth2`
368+
369+
Settings related to upstream OAuth 2.0/OIDC providers.
370+
This section must be synced to the database using the [`config sync`](../usage/cli/config.md#config-sync---prune---dry-run) command.
371+
372+
#### `upstream_oauth2.providers`
373+
374+
A list of upstream OAuth 2.0/OIDC providers to use to authenticate users.
375+
376+
Sample configurations for popular providers can be found in the [upstream provider setup](../setup/sso.md#sample-configurations) guide.
377+
378+
```yaml
379+
upstream_oauth2:
380+
providers:
381+
- # A unique identifier for the provider
382+
# Must be a valid ULID
383+
id: 01HFVBY12TMNTYTBV8W921M5FA
384+
385+
# The issuer URL, which will be used to discover the provider's configuration.
386+
# If discovery is enabled, this *must* exactly match the `issuer` field
387+
# advertised in `<issuer>/.well-known/openid-configuration`.
388+
issuer: https://example.com/
389+
390+
# A human-readable name for the provider,
391+
# which will be displayed on the login page
392+
#human_name: Example
393+
394+
# A brand identifier for the provider, which will be used to display a logo
395+
# on the login page. Values supported by the default template are:
396+
# - `apple`
397+
# - `google`
398+
# - `facebook`
399+
# - `github`
400+
# - `gitlab`
401+
# - `twitter`
402+
#brand_name: google
403+
404+
# The client ID to use to authenticate to the provider
405+
client_id: mas-fb3f0c09c4c23de4
406+
407+
# The client secret to use to authenticate to the provider
408+
# This is only used by the `client_secret_post`, `client_secret_basic`
409+
# and `client_secret_jwk` authentication methods
410+
#client_secret: f4f6bb68a0269264877e9cb23b1856ab
411+
412+
# Which authentication method to use to authenticate to the provider
413+
# Supported methods are:
414+
# - `none`
415+
# - `client_secret_basic`
416+
# - `client_secret_post`
417+
# - `client_secret_jwt`
418+
# - `private_key_jwt` (using the keys defined in the `secrets.keys` section)
419+
token_endpoint_auth_method: client_secret_post
420+
421+
# What signing algorithm to use to sign the authentication request when using
422+
# the `private_key_jwt` or the `client_secret_jwt` authentication methods
423+
#token_endpoint_auth_signing_alg: RS256
424+
425+
# The scopes to request from the provider
426+
# In most cases, it should always include `openid` scope
427+
scope: "openid email profile"
428+
429+
# How the provider configuration and endpoints should be discovered
430+
# Possible values are:
431+
# - `oidc`: discover the provider through OIDC discovery,
432+
# with strict metadata validation (default)
433+
# - `insecure`: discover through OIDC discovery, but skip metadata validation
434+
# - `disabled`: don't discover the provider and use the endpoints below
435+
#discovery_mode: oidc
436+
437+
# Whether PKCE should be used during the authorization code flow.
438+
# Possible values are:
439+
# - `auto`: use PKCE if the provider supports it (default)
440+
# Determined through discovery, and disabled if discovery is disabled
441+
# - `always`: always use PKCE (with the S256 method)
442+
# - `never`: never use PKCE
443+
#pkce_method: auto
444+
445+
# The provider authorization endpoint
446+
# This takes precedence over the discovery mechanism
447+
#authorization_endpoint: https://example.com/oauth2/authorize
448+
449+
# The provider token endpoint
450+
# This takes precedence over the discovery mechanism
451+
#token_endpoint: https://example.com/oauth2/token
452+
453+
# The provider JWKS URI
454+
# This takes precedence over the discovery mechanism
455+
#jwks_uri: https://example.com/oauth2/keys
456+
457+
# How user attributes should be mapped
458+
#
459+
# Most of those attributes have two main properties:
460+
# - `action`: what to do with the attribute. Possible values are:
461+
# - `ignore`: ignore the attribute
462+
# - `suggest`: suggest the attribute to the user, but let them opt out
463+
# - `force`: always import the attribute, and don't fail if it's missing
464+
# - `require`: always import the attribute, and fail if it's missing
465+
# - `template`: a Jinja2 template used to generate the value. In this template,
466+
# the `user` variable is available, which contains the user's attributes
467+
# retrieved from the `id_token` given by the upstream provider.
468+
#
469+
# Each attribute has a default template which follows the well-known OIDC claims.
470+
#
471+
claims_imports:
472+
# The subject is an internal identifier used to link the
473+
# user's provider identity to local accounts.
474+
# By default it uses the `sub` claim as per the OIDC spec,
475+
# which should fit most use cases.
476+
subject:
477+
#template: "{{ user.sub }}"
478+
479+
# The localpart is the local part of the user's Matrix ID.
480+
# For example, on the `example.com` server, if the localpart is `alice`,
481+
# the user's Matrix ID will be `@alice:example.com`.
482+
localpart:
483+
#action: force
484+
#template: "{{ user.preferred_username }}"
485+
486+
# The display name is the user's display name.
487+
displayname:
488+
#action: suggest
489+
#template: "{{ user.name }}"
490+
491+
# An email address to import.
492+
email:
493+
#action: suggest
494+
#template: "{{ user.email }}"
495+
496+
# Whether the email address must be marked as verified.
497+
# Possible values are:
498+
# - `import`: mark the email address as verified if the upstream provider
499+
# has marked it as verified, using the `email_verified` claim.
500+
# This is the default.
501+
# - `always`: mark the email address as verified
502+
# - `never`: mark the email address as not verified
503+
#set_email_verification: import
504+
```

0 commit comments

Comments
 (0)