Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

add OpenID example config for Gitea #9134

Merged
merged 4 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/9134.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add docs for using Gitea as OpenID provider.
36 changes: 36 additions & 0 deletions docs/openid.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,39 @@ Relevant documents:
* https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow
* Using Facebook's Graph API: https://developers.facebook.com/docs/graph-api/using-graph-api/
* Reference to the User endpoint: https://developers.facebook.com/docs/graph-api/reference/user

### Gitea

Gitea is, like Github, not an OpenID provider, but just an OAuth2 provider.

The [`/user` API endpoint](https://try.gitea.io/api/swagger#/user/userGetCurrent)
can be used to retrieve information on the authenticated user. As the Synapse
login mechanism needs an attribute to uniquely identify users, and that endpoint
does not return a `sub` property, an alternative `subject_claim` has to be set.

1. Create a new application.
2. Add this Callback URL: `[synapse public baseurl]/_synapse/oidc/callback`

Synapse config:

```yaml
oidc_providers:
- idp_id: gitea
idp_name: Gitea
idp_brand: "org.matrix.gitea" # optional: styling hint for clients
clokep marked this conversation as resolved.
Show resolved Hide resolved
discover: false
issuer: "https://your-gitea.com/"
client_id: "your-client-id" # TO BE FILLED
client_secret: "your-client-secret" # TO BE FILLED
client_auth_method: client_secret_post
scopes: [] # Gitea doesn't support Scopes
authorization_endpoint: "https://your-gitea.com/login/oauth/authorize"
token_endpoint: "https://your-gitea.com/login/oauth/access_token"
userinfo_endpoint: "https://your-gitea.com/api/v1/user"
user_mapping_provider:
config:
subject_claim: "id"
localpart_template: "{{ user.login }}"
display_name_template: "{{ user.full_name }}"
```