aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting/oauth2.go
Commit message (Collapse)AuthorAgeFilesLines
* Normalize oauth email username (#28561)Kyle D2024-01-031-1/+1
|
* Pre-register OAuth application for tea (#27509)M Hickford2023-10-081-1/+1
| | | | | | It remains to implement OAuth login in tea https://gitea.com/gitea/tea/issues/598 Fixes #27510
* Handle base64 decoding correctly to avoid panic (#26483)wxiaoguang2023-08-141-7/+6
| | | Fix the panic if the "base64 secret" is too long.
* Pre-register OAuth2 applications for git credential helpers (#26291)Denys Konovalov2023-08-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This PR is an extended implementation of #25189 and builds upon the proposal by @hickford in #25653, utilizing some ideas proposed internally by @wxiaoguang. Mainly, this PR consists of a mechanism to pre-register OAuth2 applications on startup, which can be enabled or disabled by modifying the `[oauth2].DEFAULT_APPLICATIONS` parameter in app.ini. The OAuth2 applications registered this way are being marked as "locked" and neither be deleted nor edited over UI to prevent confusing/unexpected behavior. Instead, they're being removed if no longer enabled in config. ![grafik](https://github.com/go-gitea/gitea/assets/47871822/81a78b1c-4b68-40a7-9e99-c272ebb8f62e) The implemented mechanism can also be used to pre-register other OAuth2 applications in the future, if wanted. Co-authored-by: hickford <mirth.hickford@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> --------- Co-authored-by: M Hickford <mirth.hickford@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Do not prepare oauth2 config if it is not enabled, do not write config in ↵wxiaoguang2023-06-281-0/+4
| | | | | | | | | | some sub-commands (#25567) Ref: * https://github.com/go-gitea/gitea/issues/25377#issuecomment-1609757289 And some sub-commands like "generate" / "docs", they do not need to use the ini config
* Import additional secrets via file uri (#25408)techknowlogick2023-06-231-0/+2
|
* Avoid polluting config file when "save" (#25395)wxiaoguang2023-06-211-1/+6
| | | | | | | | | | | | | That's a longstanding INI package problem: the "MustXxx" calls change the option values, and the following "Save" will save a lot of garbage options into the user's config file. Ideally we should refactor the INI package to a clear solution, but it's a huge work. A clear workaround is what this PR does: when "Save", load a clear INI instance and save it. Partially fix #25377, the "install" page needs more fine tunes.
* Avoid polluting the config (#25345)wxiaoguang2023-06-181-12/+14
| | | | | Caught by #25330 Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor config provider (#24245)Lunny Xiao2023-04-251-3/+18
| | | | | | | This PR introduces more abstract about `ConfigProvider` and hides more `ini` references. --------- Co-authored-by: delvh <dev.lh@web.de>
* Refactor the setting to make unit test easier (#22405)Lunny Xiao2023-02-201-0/+122
Some bugs caused by less unit tests in fundamental packages. This PR refactor `setting` package so that create a unit test will be easier than before. - All `LoadFromXXX` files has been splited as two functions, one is `InitProviderFromXXX` and `LoadCommonSettings`. The first functions will only include the code to create or new a ini file. The second function will load common settings. - It also renames all functions in setting from `newXXXService` to `loadXXXSetting` or `loadXXXFrom` to make the function name less confusing. - Move `XORMLog` to `SQLLog` because it's a better name for that. Maybe we should finally move these `loadXXXSetting` into the `XXXInit` function? Any idea? --------- Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: delvh <dev.lh@web.de>