1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-09-01 14:56:30 +00:00
gitea/docs/content/doc
oliverpool b6e81357bd
Add Webhook authorization header ()
_This is a different approach to , I took the liberty of adapting
some parts, see below_

## Context

In some cases, a weebhook endpoint requires some kind of authentication.
The usual way is by sending a static `Authorization` header, with a
given token. For instance:

- Matrix expects a `Bearer <token>` (already implemented, by storing the
header cleartext in the metadata - which is buggy on retry )
- TeamCity 
- Gitea instances 
- SourceHut https://man.sr.ht/graphql.md#authentication-strategies (this
is my actual personal need :)

## Proposed solution

Add a dedicated encrypt column to the webhook table (instead of storing
it as meta as proposed in ), so that it gets available for all
present and future hook types (especially the custom ones ).

This would also solve the buggy matrix retry .

As a first step, I would recommend focusing on the backend logic and
improve the frontend at a later stage. For now the UI is a simple
`Authorization` field (which could be later customized with `Bearer` and
`Basic` switches):


![2022-08-23-142911](https://user-images.githubusercontent.com/3864879/186162483-5b721504-eef5-4932-812e-eb96a68494cc.png)

The header name is hard-coded, since I couldn't fine any usecase
justifying otherwise.

## Questions

- What do you think of this approach? @justusbunsi @Gusted @silverwind 
- ~~How are the migrations generated? Do I have to manually create a new
file, or is there a command for that?~~
- ~~I started adding it to the API: should I complete it or should I
drop it? (I don't know how much the API is actually used)~~

## Done as well:

- add a migration for the existing matrix webhooks and remove the
`Authorization` logic there


_Closes #19872_

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2022-11-03 20:23:20 +02:00
..
advanced Refactor docs () 2022-10-31 23:16:19 +00:00
developers Refactor docs () 2022-10-31 23:16:19 +00:00
features Add Webhook authorization header () 2022-11-03 20:23:20 +02:00
help Fix the hook related FAQ contents () 2022-09-29 19:20:22 +02:00
installation Refactor docs () 2022-10-31 23:16:19 +00:00
packages Add support for Chocolatey/NuGet v2 API () 2022-10-13 18:19:39 +08:00
translation Add markdownlint () 2022-07-28 09:22:47 +08:00
upgrade Add redirect of /upgrade/ to /upgrade-from-gitea/ on docs site () 2022-10-06 21:53:02 +01:00
usage Refactor docs () 2022-10-31 23:16:19 +00:00
advanced.en-us.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
advanced.fr-fr.md General documentation cleanup () 2018-01-08 23:48:42 +01:00
advanced.zh-cn.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
advanced.zh-tw.md [docs] Add zh-tw Translations () 2021-01-29 01:57:58 +01:00
developers.en-us.md Add Package Registry () 2022-03-30 16:42:47 +08:00
developers.zh-cn.md Refactor docs () 2022-10-31 23:16:19 +00:00
developers.zh-tw.md Add Package Registry () 2022-03-30 16:42:47 +08:00
features.en-us.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
features.zh-cn.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
features.zh-tw.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
help.en-us.md Implement documentation search () 2019-11-13 18:03:18 +00:00
help.fr-fr.md Implement documentation search () 2019-11-13 18:03:18 +00:00
help.zh-cn.md Implement documentation search () 2019-11-13 18:03:18 +00:00
help.zh-tw.md [docs] Add zh-tw Translations () 2021-01-29 01:57:58 +01:00
installation.en-us.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
installation.fr-fr.md General documentation cleanup () 2018-01-08 23:48:42 +01:00
installation.zh-cn.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
installation.zh-tw.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
packages.en-us.md Add Package Registry () 2022-03-30 16:42:47 +08:00
translation.de-de.md Add Package Registry () 2022-03-30 16:42:47 +08:00
translation.en-us.md Add Package Registry () 2022-03-30 16:42:47 +08:00
translation.zh-tw.md Add Package Registry () 2022-03-30 16:42:47 +08:00
upgrade.en-us.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
upgrade.fr-fr.md General documentation cleanup () 2018-01-08 23:48:42 +01:00
upgrade.zh-cn.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
upgrade.zh-tw.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
usage.en-us.md Import docs into main repository () 2017-11-26 23:44:32 +02:00
usage.zh-cn.md ZH-CN translation of Usage part () 2018-10-17 14:19:04 -04:00
usage.zh-tw.md [docs] Add zh-tw Translations () 2021-01-29 01:57:58 +01:00