OIDC without discovery file #5426

Closed
opened 2025-11-02 06:24:37 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @wohenbushuang on GitHub (May 19, 2020).

  • Gitea version (or commit ref): 1.12.0+dev-331-g4744e1e0f
  • Git version:
  • Operating system: ubuntu+docker
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Our school have OIDC service but won't provide discovery file .well-known/openid-configuration. I've successfully configurated the openID by writing those urls into a file in custom/public/.well-known/openid-configuration and set the discovery link to it by http://my-gitea-site-url/.well-known/openid-configuration. But if I restart the doccker container, gitea will check the discovery file link again and then fail because the gitea service haven't start at that time. And docker container will terminate.

gitea log
2020/05/19 15:24:29 ...uth/oauth2/oauth2.go:174:createProvider() [W] Failed to create OpenID Connect Provider with name 'oidc' with url 'http://my-gitea-site-url/.well-known/openid-configuration': Get "http://my-gitea-site-url/.well-known/openid-configuration": EOF
2020/05/19 15:24:29 routers/init.go:107:GlobalInit() [F] Failed to initialize OAuth2 support: Get "http://my-gitea-site-url/.well-known/openid-configuration": EOF
docker log
Received signal 15; terminating.

I wonder:

  1. besides a url, can the discovery file have some mannually input way and store it in db, or can use a local file?
  2. otherwise, when gitea check discovery file fail, can gitea still serve without that OIDC, but not just terminate?
  3. can OIDC have custom logo (e.g. i can set as my school logo) on the sign in page when configuring oidc settings, instead of default logo?
Originally created by @wohenbushuang on GitHub (May 19, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.12.0+dev-331-g4744e1e0f - Git version: - Operating system: ubuntu+docker - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Our school have OIDC service but won't provide discovery file `.well-known/openid-configuration`. I've successfully configurated the openID by writing those urls into a file in `custom/public/.well-known/openid-configuration` and set the discovery link to it by `http://my-gitea-site-url/.well-known/openid-configuration`. But if I restart the doccker container, gitea will check the discovery file link again and then fail because the gitea service haven't start at that time. And docker container will terminate. <details> <summary>gitea log</summary> <pre> 2020/05/19 15:24:29 ...uth/oauth2/oauth2.go:174:createProvider() [W] Failed to create OpenID Connect Provider with name 'oidc' with url 'http://my-gitea-site-url/.well-known/openid-configuration': Get "http://my-gitea-site-url/.well-known/openid-configuration": EOF 2020/05/19 15:24:29 routers/init.go:107:GlobalInit() [F] Failed to initialize OAuth2 support: Get "http://my-gitea-site-url/.well-known/openid-configuration": EOF </pre> </details> <details> <summary>docker log</summary> <pre> Received signal 15; terminating. </pre> </details> I wonder: 1. besides a url, can the discovery file have some mannually input way and store it in db, or can use a local file? 1. otherwise, when gitea check discovery file fail, can gitea still serve without that OIDC, but not just terminate? 1. can OIDC have custom logo (e.g. i can set as my school logo) on the sign in page when configuring oidc settings, instead of default logo?
GiteaMirror added the type/question label 2025-11-02 06:24:37 -06:00
Author
Owner

@techknowlogick commented on GitHub (Jun 6, 2020):

  1. only a URL can be used. It would need to be hosted on an URL other than gitea itself, because it checks for the login information before enabling web access.
  2. fail happens because some users only use oidc, and if the endpoint wasn't up, then gitea would fail anyway due to auth not working (and it is a sideeffect of the upstream library we use)
  3. custom logos are indeed possible (I do this myself), please review https://docs.gitea.io/en-us/customizing-gitea/ for overriding default files/images.

I'm closing this now, but please feel free to hop into chat https://discord.gg/gitea if you have any other questions.

@techknowlogick commented on GitHub (Jun 6, 2020): 1. only a URL can be used. It would need to be hosted on an URL other than gitea itself, because it checks for the login information before enabling web access. 2. fail happens because some users only use oidc, and if the endpoint wasn't up, then gitea would fail anyway due to auth not working (and it is a sideeffect of the upstream library we use) 3. custom logos are indeed possible (I do this myself), please review https://docs.gitea.io/en-us/customizing-gitea/ for overriding default files/images. I'm closing this now, but please feel free to hop into chat https://discord.gg/gitea if you have any other questions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5426