diff options
author | 2021-05-09 20:34:27 +0200 | |
---|---|---|
committer | 2021-05-09 20:34:27 +0200 | |
commit | dc338dc881ead40723f0540aac7fe894f58b174d (patch) | |
tree | a000a065ffe219683f68520dd66b12aa1506a9fa /internal/federation/util.go | |
parent | Fix token sweep (#19) (diff) | |
download | gotosocial-dc338dc881ead40723f0540aac7fe894f58b174d.tar.xz |
Webfinger + Small fixes (#20)
Diffstat (limited to 'internal/federation/util.go')
-rw-r--r-- | internal/federation/util.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/federation/util.go b/internal/federation/util.go index ab854db7c..d76ce853d 100644 --- a/internal/federation/util.go +++ b/internal/federation/util.go @@ -112,6 +112,9 @@ func getPublicKeyFromResponse(c context.Context, b []byte, keyID *url.URL) (voca // Also note that this function *does not* dereference the remote account that the signature key is associated with. // Other functions should use the returned URL to dereference the remote account, if required. func (f *federator) AuthenticateFederatedRequest(username string, r *http.Request) (*url.URL, error) { + // set this extra field for signature validation + r.Header.Set("host", f.config.Host) + verifier, err := httpsig.NewVerifier(r) if err != nil { return nil, fmt.Errorf("could not create http sig verifier: %s", err) @@ -208,7 +211,11 @@ func (f *federator) DereferenceRemoteAccount(username string, remoteAccountID *u } return p, nil case string(gtsmodel.ActivityStreamsApplication): - // TODO: convert application into person + p, ok := t.(vocab.ActivityStreamsApplication) + if !ok { + return nil, errors.New("error resolving type as activitystreams application") + } + return p, nil } return nil, fmt.Errorf("type name %s not supported", t.GetTypeName()) |