mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-05 09:55:20 +02:00
feat(activitiypub): enable HTTP signatures on all ActivityPub endpoints (#7035)
- Set the right keyID and use the right signing keys for outgoing requests. - Verify the HTTP signature of all incoming requests, except for the server actor. - Caches keys of incoming requests for users and servers actors. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7035 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: famfo <famfo@famfo.xyz> Co-committed-by: famfo <famfo@famfo.xyz>
This commit is contained in:
parent
ba5b157f7e
commit
77b0275572
22 changed files with 681 additions and 122 deletions
|
@ -139,9 +139,21 @@ func TestAPActorID(t *testing.T) {
|
|||
user := user_model.User{ID: 1}
|
||||
url := user.APActorID()
|
||||
expected := "https://try.gitea.io/api/v1/activitypub/user-id/1"
|
||||
if url != expected {
|
||||
t.Errorf("unexpected APActorID, expected: %q, actual: %q", expected, url)
|
||||
}
|
||||
assert.Equal(t, expected, url)
|
||||
}
|
||||
|
||||
func TestAPActorID_APActorID(t *testing.T) {
|
||||
user := user_model.User{ID: user_model.APServerActorUserID}
|
||||
url := user.APActorID()
|
||||
expected := "https://try.gitea.io/api/v1/activitypub/actor"
|
||||
assert.Equal(t, expected, url)
|
||||
}
|
||||
|
||||
func TestAPActorKeyID(t *testing.T) {
|
||||
user := user_model.User{ID: 1}
|
||||
url := user.APActorKeyID()
|
||||
expected := "https://try.gitea.io/api/v1/activitypub/user-id/1#main-key"
|
||||
assert.Equal(t, expected, url)
|
||||
}
|
||||
|
||||
func TestSearchUsers(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue