Class: DiasporaFederation::WebfingerController

Inherits:
ApplicationController show all
Defined in:
app/controllers/diaspora_federation/webfinger_controller.rb

Overview

This controller handles all webfinger-specific requests.

Instance Method Summary collapse

Methods inherited from ApplicationController

#set_locale

Instance Method Details

#webfingerObject

Returns the webfinger as RFC 7033 JRD or XRD.

JSON example:

{
  "subject": "acct:alice@localhost:3000",
  "aliases": [
    "http://localhost:3000/people/c8e87290f6a20132963908fbffceb188"
  ],
  "links": [
    {
      "rel": "http://microformats.org/profile/hcard",
      "type": "text/html",
      "href": "http://localhost:3000/hcard/users/c8e87290f6a20132963908fbffceb188"
    },
    {
      "rel": "http://joindiaspora.com/seed_location",
      "type": "text/html",
      "href": "http://localhost:3000/"
    },
    {
      "rel": "http://webfinger.net/rel/profile-page",
      "type": "text/html",
      "href": "http://localhost:3000/u/alice"
    },
    {
      "rel": "http://schemas.google.com/g/2010#updates-from",
      "type": "application/atom+xml",
      "href": "http://localhost:3000/public/alice.atom"
    },
    {
      "rel": "salmon",
      "href": "http://localhost:3000/receive/users/c8e87290f6a20132963908fbffceb188"
    },
    {
      "rel": "http://ostatus.org/schema/1.0/subscribe",
      "template": "http://localhost:3000/people?q={uri}"
    }
  ]
}

GET /.well-known/webfinger?resource=<uri>



49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/controllers/diaspora_federation/webfinger_controller.rb', line 49

def webfinger
  person_wf = find_person_webfinger(params.require(:resource))

  if person_wf.nil?
    head :not_found
  else
    logger.info "Webfinger profile request for: #{person_wf.acct_uri}"

    headers["Access-Control-Allow-Origin"] = "*"
    render json: JSON.pretty_generate(person_wf.to_json), content_type: "application/jrd+json"
  end
end