mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-28 17:13:32 -06:00
[chore] Refactor AP authentication, other small bits of tidying up (#1874)
This commit is contained in:
parent
433b56d2f9
commit
24fbdf2b0a
38 changed files with 1280 additions and 996 deletions
|
|
@ -87,7 +87,7 @@ func (t *transport) GET(r *http.Request) (*http.Response, error) {
|
|||
return nil, errors.New("must be GET request")
|
||||
}
|
||||
ctx := r.Context() // extract, set pubkey ID.
|
||||
ctx = gtscontext.SetPublicKeyID(ctx, t.pubKeyID)
|
||||
ctx = gtscontext.SetOutgoingPublicKeyID(ctx, t.pubKeyID)
|
||||
r = r.WithContext(ctx) // replace request ctx.
|
||||
r.Header.Set("User-Agent", t.controller.userAgent)
|
||||
return t.controller.client.DoSigned(r, t.signGET())
|
||||
|
|
@ -99,7 +99,7 @@ func (t *transport) POST(r *http.Request, body []byte) (*http.Response, error) {
|
|||
return nil, errors.New("must be POST request")
|
||||
}
|
||||
ctx := r.Context() // extract, set pubkey ID.
|
||||
ctx = gtscontext.SetPublicKeyID(ctx, t.pubKeyID)
|
||||
ctx = gtscontext.SetOutgoingPublicKeyID(ctx, t.pubKeyID)
|
||||
r = r.WithContext(ctx) // replace request ctx.
|
||||
r.Header.Set("User-Agent", t.controller.userAgent)
|
||||
return t.controller.client.DoSigned(r, t.signPOST(body))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue