2022-07-01 03:07:02 +00:00
---
title: "Gitea"
description: "Integrating Gitea with the Authelia OpenID Connect Provider."
lead: ""
2022-07-12 18:29:52 +00:00
date: 2022-07-01T13:07:02+10:00
2022-07-01 03:07:02 +00:00
draft: false
images: []
menu:
integration:
parent: "openid-connect"
weight: 620
toc: true
community: true
---
## Tested Versions
* [Authelia]
2022-08-02 00:27:23 +00:00
* [v4.36.3 ](https://github.com/authelia/authelia/releases/tag/v4.36.3 )
2022-07-01 03:07:02 +00:00
* [Gitea]
2022-08-02 00:27:23 +00:00
* [1.17.0 ](https://github.com/go-gitea/gitea/releases/tag/v1.17.0 )
2022-07-01 03:07:02 +00:00
## Before You Begin
2023-02-02 01:30:06 +00:00
{{% oidc-common %}}
2022-10-20 04:42:22 +00:00
2022-10-20 04:27:09 +00:00
### Assumptions
2022-07-01 03:07:02 +00:00
This example makes the following assumptions:
* __Application Root URL:__ `https://gitea.example.com`
* __Authelia Root URL:__ `https://auth.example.com`
* __Client ID:__ `gitea`
2023-02-02 01:30:06 +00:00
* __Client Secret:__ `insecure_secret`
2023-02-12 20:49:43 +00:00
* __Authentication Name (Gitea):__ `authelia` :
* This option determines the redirect URI in the format of
`https://gitea.example.com/user/oauth2/<Authentication Name>/callback` .
This means if you change this value you need to update the redirect URI.
2022-07-01 03:07:02 +00:00
## Configuration
### Application
2023-01-25 23:59:18 +00:00
To configure [Gitea] to utilize Authelia as an [OpenID Connect 1.0] Provider:
2022-07-01 03:07:02 +00:00
1. Expand User Options
2. Visit Site Administration
3. Visit Authentication Sources
4. Visit Add Authentication Source
5. Configure:
1. Authentication Name: `authelia`
2. OAuth2 Provider: `OpenID Connect`
3. Client ID (Key): `gitea`
2023-02-02 01:30:06 +00:00
4. Client Secret: `insecure_secret`
2022-07-01 03:07:02 +00:00
5. OpenID Connect Auto Discovery URL: `https://auth.example.com/.well-known/openid-configuration`
{{< figure src = "gitea.png" alt = "Gitea" width = "300" > }}
2023-01-25 23:59:18 +00:00
To configure [Gitea] to perform automatic user creation for the `auth.example.com` domain via [OpenID Connect 1.0]:
2022-08-07 04:56:33 +00:00
1. Edit the following values in the [Gitea] `app.ini` :
```ini
2022-08-06 22:25:28 +00:00
[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = true
2022-08-07 04:56:33 +00:00
WHITELISTED_URIS = auth.example.com
2022-08-06 22:25:28 +00:00
[service]
DISABLE_REGISTRATION = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = true
SHOW_REGISTRATION_BUTTON = false
```
2022-08-07 04:56:33 +00:00
Take a look at the [See Also ](#see-also ) section for the cheatsheets corresponding to the sections above for their
descriptions.
2022-08-06 22:25:28 +00:00
2022-07-01 03:07:02 +00:00
### Authelia
The following YAML configuration is an example __Authelia__
2023-05-15 00:32:10 +00:00
[client configuration ](../../../configuration/identity-providers/openid-connect/clients.md ) for use with [Gitea] which
2022-07-01 03:07:02 +00:00
will operate with the above example:
```yaml
2023-04-02 03:12:01 +00:00
identity_providers:
oidc:
## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
## See: https://www.authelia.com/c/oidc
clients:
2023-05-07 06:39:17 +00:00
- id: 'gitea'
description: 'Gitea'
2023-04-02 03:12:01 +00:00
secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.
public: false
2023-05-07 06:39:17 +00:00
authorization_policy: 'two_factor'
2023-04-02 03:12:01 +00:00
redirect_uris:
2023-05-07 06:39:17 +00:00
- 'https://gitea.example.com/user/oauth2/authelia/callback'
2023-04-02 03:12:01 +00:00
scopes:
2023-05-07 06:39:17 +00:00
- 'openid'
- 'email'
- 'profile'
2023-05-15 00:32:10 +00:00
userinfo_signing_alg: 'none'
2022-07-01 03:07:02 +00:00
```
2022-08-07 04:56:33 +00:00
## See Also
2023-04-02 03:12:01 +00:00
- [Gitea] app.ini [Config Cheat Sheet ](https://docs.gitea.io/en-us/config-cheat-sheet ):
- [OpenID ](https://docs.gitea.io/en-us/config-cheat-sheet/#openid-openid )
- [Service ](https://docs.gitea.io/en-us/config-cheat-sheet/#service-service )
2022-08-07 04:56:33 +00:00
2022-07-01 03:07:02 +00:00
[Gitea]: https://gitea.io/
2023-01-25 23:59:18 +00:00
[OpenID Connect 1.0]: ../../openid-connect/introduction.md