Skip to content

Commit 80e39fd

Browse files
authored
Add Forgejo oidc provider config example (#17872)
1 parent 573bdbc commit 80e39fd

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

changelog.d/17872.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add OIDC example configuration for Forgejo (fork of Gitea).

docs/openid.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,36 @@ but it has a `response_types_supported` which excludes "code" (which we rely on,
336336
is even mentioned in their [documentation](https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#login)),
337337
so we have to disable discovery and configure the URIs manually.
338338

339+
### Forgejo
340+
341+
Forgejo is a fork of Gitea that can act as an OAuth2 provider.
342+
343+
The implementation of OAuth2 is improved compared to Gitea, as it provides a correctly defined `subject_claim` and `scopes`.
344+
345+
Synapse config:
346+
347+
```yaml
348+
oidc_providers:
349+
- idp_id: forgejo
350+
idp_name: Forgejo
351+
discover: false
352+
issuer: "https://your-forgejo.com/"
353+
client_id: "your-client-id" # TO BE FILLED
354+
client_secret: "your-client-secret" # TO BE FILLED
355+
client_auth_method: client_secret_post
356+
scopes: ["openid", "profile", "email", "groups"]
357+
authorization_endpoint: "https://your-forgejo.com/login/oauth/authorize"
358+
token_endpoint: "https://your-forgejo.com/login/oauth/access_token"
359+
userinfo_endpoint: "https://your-forgejo.com/api/v1/user"
360+
user_mapping_provider:
361+
config:
362+
subject_claim: "sub"
363+
picture_claim: "picture"
364+
localpart_template: "{{ user.preferred_username }}"
365+
display_name_template: "{{ user.name }}"
366+
email_template: "{{ user.email }}"
367+
```
368+
339369
### GitHub
340370

341371
[GitHub][github-idp] is a bit special as it is not an OpenID Connect compliant provider, but

0 commit comments

Comments
 (0)