diff --git a/app/controllers/diaspora_federation/webfinger_controller.rb b/app/controllers/diaspora_federation/webfinger_controller.rb
index 0521ed9..542eb8f 100644
--- a/app/controllers/diaspora_federation/webfinger_controller.rb
+++ b/app/controllers/diaspora_federation/webfinger_controller.rb
@@ -8,7 +8,8 @@ module DiasporaFederation
# example:
#
#
- #
+ #
#
#
# GET /.well-known/host-meta
@@ -91,35 +92,6 @@ module DiasporaFederation
end
end
- # @deprecated This is the pre RFC 7033 webfinger.
- #
- # example:
- #
- #
- # acct:alice@localhost:3000
- # http://localhost:3000/people/c8e87290f6a20132963908fbffceb188
- #
- #
- #
- #
- #
- #
- #
- #
- # GET /webfinger?q=
- def legacy_webfinger
- person_wf = find_person_webfinger(params[:q]) if params[:q]
-
- if person_wf.nil?
- head :not_found
- else
- logger.info "webfinger profile request for: #{person_wf.acct_uri}"
- render xml: person_wf.to_xml, content_type: "application/xrd+xml"
- end
- end
-
# Creates the host-meta xml with the configured server_uri and caches it
# @return [String] XML string
def self.host_meta_xml
diff --git a/config/routes.rb b/config/routes.rb
index d6d0829..5e7086f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,9 +9,8 @@ DiasporaFederation::Engine.routes.draw do
end
controller :webfinger do
- get ".well-known/host-meta" => :host_meta, :as => "host_meta"
- get ".well-known/webfinger" => :webfinger, :as => "webfinger"
- get "webfinger" => :legacy_webfinger, :as => "legacy_webfinger"
+ get ".well-known/host-meta" => :host_meta, :as => "host_meta"
+ get ".well-known/webfinger" => :webfinger, :as => "webfinger"
end
controller :h_card do
diff --git a/docs/discovery/webfinger.md b/docs/discovery/webfinger.md
index 75a157e..b2044f2 100644
--- a/docs/discovery/webfinger.md
+++ b/docs/discovery/webfinger.md
@@ -6,7 +6,7 @@ diaspora\* uses an old draft of [WebFinger][webfinger-draft] to discover users f
{% include warning_box.html
title="Old WebFinger"
- content="
diaspora* doesn't yet support the RFC 7033 WebFinger!
"
+ content="
diaspora* doesn't yet fully support the RFC 7033 WebFinger!
"
%}
## WebFinger endpoint discovery
@@ -54,7 +54,7 @@ Content-Type: application/xrd+xml; charset=utf-8
~~~xml
-
+
~~~
@@ -70,7 +70,7 @@ of the searched person.
#### Example
~~~
-GET /webfinger?q=acct:alice@example.org
+GET /.well-known/webfinger.xml?resource=acct:alice@example.org
Host: example.org
~~~
@@ -117,6 +117,7 @@ Content-Type: application/xrd+xml; charset=utf-8
* [RFC 6415: Web Host Metadata][host-meta]
* [WebFinger draft][webfinger-draft]
* [Extensible Resource Descriptor (XRD) Version 1.0][xrd]
+* [RFC 7033: WebFinger][webfinger-rfc]
[host-meta]: https://tools.ietf.org/html/rfc6415
[webfinger-draft]: https://tools.ietf.org/html/draft-jones-appsawg-webfinger-06
diff --git a/lib/diaspora_federation/discovery/host_meta.rb b/lib/diaspora_federation/discovery/host_meta.rb
index 0c2f8fc..076306f 100644
--- a/lib/diaspora_federation/discovery/host_meta.rb
+++ b/lib/diaspora_federation/discovery/host_meta.rb
@@ -26,7 +26,7 @@ module DiasporaFederation
end
# URL fragment to append to the base URL
- WEBFINGER_SUFFIX = "/webfinger?q={uri}".freeze
+ WEBFINGER_SUFFIX = "/.well-known/webfinger.xml?resource={uri}".freeze
# Returns the WebFinger URL that was used to build this instance (either from
# xml or by giving a base URL).
diff --git a/spec/controllers/diaspora_federation/rails4_spec.rb b/spec/controllers/diaspora_federation/rails4_spec.rb
index 4d506b5..7225c9a 100644
--- a/spec/controllers/diaspora_federation/rails4_spec.rb
+++ b/spec/controllers/diaspora_federation/rails4_spec.rb
@@ -17,13 +17,13 @@ module DiasporaFederation
public_key: alice.serialized_public_key
).to_xml
- get :legacy_webfinger, q: alice.diaspora_id
+ get :webfinger, format: :xml, resource: alice.diaspora_id
expect(response).to be_success
expect(response.body).to eq(webfinger_xrd)
end
it "404s when the person does not exist" do
- get :legacy_webfinger, q: "me@mydiaspora.pod.com"
+ get :webfinger, format: :xml, resource: "me@mydiaspora.pod.com"
expect(response).to be_not_found
end
end
diff --git a/spec/controllers/diaspora_federation/webfinger_controller_spec.rb b/spec/controllers/diaspora_federation/webfinger_controller_spec.rb
index d740656..862a7fb 100644
--- a/spec/controllers/diaspora_federation/webfinger_controller_spec.rb
+++ b/spec/controllers/diaspora_federation/webfinger_controller_spec.rb
@@ -15,7 +15,7 @@ module DiasporaFederation
it "contains the webfinger-template" do
get :host_meta
- expect(response.body).to include "template=\"http://localhost:3000/webfinger?q={uri}\""
+ expect(response.body).to include "template=\"http://localhost:3000/.well-known/webfinger.xml?resource={uri}\""
end
it "returns a application/xrd+xml" do
@@ -119,33 +119,5 @@ module DiasporaFederation
end
end
end
-
- describe "GET #legacy_webfinger", rails: 5 do
- it "succeeds when the person exists" do
- get :legacy_webfinger, params: {q: alice.diaspora_id}
- expect(response).to be_success
- end
-
- it "succeeds with 'acct:' in the query when the person exists" do
- get :legacy_webfinger, params: {q: "acct:#{alice.diaspora_id}"}
- expect(response).to be_success
- end
-
- it "contains the diaspora* ID" do
- get :legacy_webfinger, params: {q: "acct:#{alice.diaspora_id}"}
- expect(response.body).to include "acct:alice@localhost:3000"
- end
-
- it "404s when the person does not exist" do
- get :legacy_webfinger, params: {q: "me@mydiaspora.pod.com"}
- expect(response).to be_not_found
- end
-
- it "calls the fetch_person_for_webfinger callback" do
- expect_callback(:fetch_person_for_webfinger, "alice@localhost:3000").and_call_original
-
- get :legacy_webfinger, params: {q: "acct:alice@localhost:3000"}
- end
- end
end
end
diff --git a/spec/lib/diaspora_federation/discovery/discovery_spec.rb b/spec/lib/diaspora_federation/discovery/discovery_spec.rb
index a9a36b3..5c380ac 100644
--- a/spec/lib/diaspora_federation/discovery/discovery_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/discovery_spec.rb
@@ -49,7 +49,7 @@ module DiasporaFederation
it "fetches the userdata and returns a person object" do
stub_request(:get, "https://localhost:3000/.well-known/host-meta")
.to_return(status: 200, body: host_meta_xrd)
- stub_request(:get, "http://localhost:3000/webfinger?q=acct:#{account}")
+ stub_request(:get, "http://localhost:3000/.well-known/webfinger.xml?resource=acct:#{account}")
.to_return(status: 200, body: webfinger_xrd)
stub_request(:get, "http://localhost:3000/hcard/users/#{alice.guid}")
.to_return(status: 200, body: hcard_html)
@@ -76,7 +76,7 @@ module DiasporaFederation
it "fetches the userdata and saves the person object via callback" do
stub_request(:get, "https://localhost:3000/.well-known/host-meta")
.to_return(status: 200, body: host_meta_xrd)
- stub_request(:get, "http://localhost:3000/webfinger?q=acct:#{account}")
+ stub_request(:get, "http://localhost:3000/.well-known/webfinger.xml?resource=acct:#{account}")
.to_return(status: 200, body: webfinger_xrd)
stub_request(:get, "http://localhost:3000/hcard/users/#{alice.guid}")
.to_return(status: 200, body: hcard_html)
@@ -96,7 +96,7 @@ module DiasporaFederation
.to_return(status: 404)
stub_request(:get, "http://localhost:3000/.well-known/host-meta")
.to_return(status: 200, body: host_meta_xrd)
- stub_request(:get, "http://localhost:3000/webfinger?q=acct:#{account}")
+ stub_request(:get, "http://localhost:3000/.well-known/webfinger.xml?resource=acct:#{account}")
.to_return(status: 200, body: webfinger_xrd)
stub_request(:get, "http://localhost:3000/hcard/users/#{alice.guid}")
.to_return(status: 200, body: hcard_html)
@@ -113,7 +113,7 @@ module DiasporaFederation
.to_raise(OpenSSL::SSL::SSLError)
stub_request(:get, "http://localhost:3000/.well-known/host-meta")
.to_return(status: 200, body: host_meta_xrd)
- stub_request(:get, "http://localhost:3000/webfinger?q=acct:#{account}")
+ stub_request(:get, "http://localhost:3000/.well-known/webfinger.xml?resource=acct:#{account}")
.to_return(status: 200, body: webfinger_xrd)
stub_request(:get, "http://localhost:3000/hcard/users/#{alice.guid}")
.to_return(status: 200, body: hcard_html)
@@ -130,7 +130,7 @@ module DiasporaFederation
stub_request(:get, "https://localhost:3000/.well-known/host-meta")
.to_return(status: 200, body: host_meta_xrd)
- stub_request(:get, "http://localhost:3000/webfinger?q=acct:#{account}")
+ stub_request(:get, "http://localhost:3000/.well-known/webfinger.xml?resource=acct:#{account}")
.to_return(status: 200, body: modified_webfinger)
expect { Discovery::Discovery.new(account).fetch_and_save }.to raise_error Discovery::DiscoveryError
@@ -139,7 +139,7 @@ module DiasporaFederation
it "fails if the diaspora* ID was not found" do
stub_request(:get, "https://localhost:3000/.well-known/host-meta")
.to_return(status: 200, body: host_meta_xrd)
- stub_request(:get, "http://localhost:3000/webfinger?q=acct:#{account}")
+ stub_request(:get, "http://localhost:3000/.well-known/webfinger.xml?resource=acct:#{account}")
.to_return(status: 404)
expect { Discovery::Discovery.new(account).fetch_and_save }.to raise_error Discovery::DiscoveryError
diff --git a/spec/lib/diaspora_federation/discovery/host_meta_spec.rb b/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
index 65f4d47..aeb6fa6 100644
--- a/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
@@ -4,7 +4,7 @@ module DiasporaFederation
let(:xml) { <<-XML }
-
+
XML
@@ -36,7 +36,7 @@ XML
context "parsing" do
it "parses its own output" do
hm = Discovery::HostMeta.from_xml(xml)
- expect(hm.webfinger_template_url).to eq("#{base_url}webfinger?q={uri}")
+ expect(hm.webfinger_template_url).to eq("#{base_url}.well-known/webfinger.xml?resource={uri}")
end
it "also reads old-style XML" do
diff --git a/spec/routing/webfinger_routing_spec.rb b/spec/routing/webfinger_routing_spec.rb
index ccb48d9..11f845a 100644
--- a/spec/routing/webfinger_routing_spec.rb
+++ b/spec/routing/webfinger_routing_spec.rb
@@ -15,12 +15,5 @@ module DiasporaFederation
action: "webfinger"
)
end
-
- it "routes GET legacy webfinger" do
- expect(get: "/webfinger").to route_to(
- controller: "diaspora_federation/webfinger",
- action: "legacy_webfinger"
- )
- end
end
end