added the namespace constraint back to the envelope, protocol route, data type is now plain xml
This commit is contained in:
parent
c98189b057
commit
f1a8b1fd6f
3 changed files with 11 additions and 7 deletions
|
|
@ -157,6 +157,9 @@ Diaspora::Application.routes.draw do
|
|||
|
||||
get 'mobile/toggle', :to => 'home#toggle_mobile', :as => 'toggle_mobile'
|
||||
|
||||
#Protocol Url
|
||||
get 'protocol' => redirect("https://github.com/diaspora/diaspora/wiki/Diaspora%27s-federation-protocol")
|
||||
|
||||
# Startpage
|
||||
|
||||
root :to => 'home#show'
|
||||
|
|
|
|||
|
|
@ -10,21 +10,22 @@ module Salmon
|
|||
# @return [MagicSigEnvelope]
|
||||
def self.parse(doc)
|
||||
env = self.new
|
||||
env.encoding = doc.search('//me:env/me:encoding').text.strip
|
||||
ns = {'me'=>'http://salmon-protocol.org/ns/magic-env'}
|
||||
env.encoding = doc.search('//me:env/me:encoding', ns).text.strip
|
||||
|
||||
if env.encoding != 'base64url'
|
||||
raise ArgumentError, "Magic Signature data must be encoded with base64url, was #{env.encoding}"
|
||||
end
|
||||
|
||||
env.data = doc.search('//me:env/me:data').text
|
||||
env.alg = doc.search('//me:env/me:alg').text.strip
|
||||
env.data = doc.search('//me:env/me:data', ns).text
|
||||
env.alg = doc.search('//me:env/me:alg', ns).text.strip
|
||||
|
||||
unless 'RSA-SHA256' == env.alg
|
||||
raise ArgumentError, "Magic Signature data must be signed with RSA-SHA256, was #{env.alg}"
|
||||
end
|
||||
|
||||
env.sig = doc.search('//me:env/me:sig').text
|
||||
env.data_type = doc.search('//me:env/me:data').first['type'].strip
|
||||
env.sig = doc.search('//me:env/me:sig', ns).text
|
||||
env.data_type = doc.search('//me:env/me:data', ns).first['type'].strip
|
||||
|
||||
env
|
||||
end
|
||||
|
|
@ -69,7 +70,7 @@ ENTRY
|
|||
|
||||
# @return [String]
|
||||
def get_data_type
|
||||
'application/atom+xml'
|
||||
'application/xml'
|
||||
end
|
||||
|
||||
# @return [String]
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ module Salmon
|
|||
def xml_for(person)
|
||||
@xml =<<ENTRY
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<diaspora xmlns="https://github.com/diaspora/diaspora/wiki/Diaspora%27s-federation-protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env">
|
||||
<diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env">
|
||||
#{header(person)}
|
||||
#{@magic_sig.to_xml}
|
||||
</diaspora>
|
||||
|
|
|
|||
Loading…
Reference in a new issue