mirror of
https://codeberg.org/icewind/rss-webhook-trigger.git
synced 2026-11-30 04:00:49 +01:00
allow generating jwt key at startup
This commit is contained in:
parent
2dcb4f08e5
commit
44ed58f9d8
6 changed files with 369 additions and 67 deletions
23
README.md
23
README.md
|
|
@ -37,15 +37,19 @@ hook = "https://hook.example.com/hook2/call"
|
|||
|
||||
### JWT Authorization
|
||||
|
||||
rss-webhook-trigger supports generating JWT tokens to use for authorization. This can be used to authenticate against various services without the need for long-lived keys.
|
||||
rss-webhook-trigger supports generating JWT tokens to use for authorization. This can be used to authenticate against various services without the need for long-lived shared keys.
|
||||
|
||||
This current has been tested with [Forgejo's Authorized Integrations](https://forgejo.org/docs/latest/user/api/authorized-integrations).
|
||||
|
||||
#### With dynamic key
|
||||
|
||||
By default, rss-webhook-trigger will generate a new RS256 JWT key at startup, combined with serving the OIDC metadata and keys over http, this removes the need to store any long term key.
|
||||
Services authenticating against the generated JWT token can lookup the public key based on the issuer to validate the token.
|
||||
|
||||
```toml
|
||||
[jwt]
|
||||
key = "RS256 JWT key, or path to the key"
|
||||
issuer = "https://example.com"
|
||||
# optionally, serve `/.well-known/openid-configuration` and `/.well-known/keys` with the key information
|
||||
# serve `/.well-known/openid-configuration` and `/.well-known/keys`, relative to the `issuer`, with the key information
|
||||
listen = { address = "0.0.0.0", port = "3000" }
|
||||
# listen = {path = "/var/run/webhook.sock" }
|
||||
|
||||
|
|
@ -56,6 +60,19 @@ headers = { authorization = {type = "jwt", aud: "...."} }
|
|||
body = { event_type = "build" }
|
||||
```
|
||||
|
||||
#### With static key
|
||||
|
||||
Altnerativelly, you can specify the private RS256 key in the configuration.
|
||||
|
||||
```toml
|
||||
[jwt]
|
||||
key = "RS256 JWT key, or path to the key"
|
||||
issuer = "https://example.com"
|
||||
# the `listen` option can be left out in cases where the service performing authentication allows manually configuring the public key
|
||||
|
||||
# rest of the config as above
|
||||
```
|
||||
|
||||
### Usage in NixOS
|
||||
|
||||
A NixOS module is included and can be used like this:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue