Skip to content

Commit

Permalink
Merge branch 'master' of git@cucal.dit.upm.es:openid-observatory
Browse files Browse the repository at this point in the history
  • Loading branch information
amendo committed May 18, 2010
2 parents 71d240a + aa4da7c commit ad87b2d
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 111 deletions.
221 changes: 115 additions & 106 deletions app/helpers/application_helper.rb
Expand Up @@ -16,90 +16,39 @@ def graphs(options = {})
def build_graphs
[
{
:title => t = 'Deployed OpenID Protocol Versions',
:title => t = 'OpenID URI Domains',
:description => ( brief? ?
"OpenID protocol versions currently deployed and announced by identifiers" :
'OpenID protocol currently defines three versions. <a href="http://openid.net/specs/openid-authentication-1_1.html">Version 1.1</a> was published on May 2006. <a href="http://openid.net/specs/openid-authentication-2_0.html">Version 2.0</a> a year and half later. Most of OpenID identifiers do not support the lastest version of the protocol. Among the identifiers supporting it, most of them maintain compatibility with former versions.' ),
:results => r = {
"v1, v1.1" => Uri.openid_version(:only_1).count,
"v2" => Uri.openid_version(:only_2).count,
"all" => Uri.openid_version(:both).count
},

'Most common domains used in OpenID identifiers' :
'This graph analyzes the domains most used as OpenID identifiers. There is a strong tendency to use own customized domains, usually personal blogs and homepages. <a href="http://blogspot.com/">Blogger</a> and <a href="http://myopenid.com/">myOpenID</a> are the most popular domains. Other blogging platforms follow, including <a href="http://wordpress.com/">Wordpress</a> and <a href="http://livejournal.com/">LiveJournal</a>.' ),
:results => r = domain_results,
:image => pie(:title => t,
:data => r.values,
:legend => r.keys),
:details => r.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last * 100.0 / Uri.openid_version(:any).count }"
d << "</p>"
d
end
:data => r.last.map(&:last).flatten,
:legend => r.last.map(&:first).flatten,
:encoding => 'extended',
:orientation => 'h'),
},
{
:title => t = 'OpenID Discovery Technologies (%)',
:description => ( brief? ?
'OpenID can be discovered both by a HTML header link or using Yadis discovery' :
'OpenID specifications define two ways for discovering the OpenID service upon the identifier and starting protocol requests. Through the specifications prioritize <a href="http://en.wikipedia.org/wiki/Yadis">Yadis</a> as the first option to be tried, it is only supported by half of the identifiers. On the other hand, <a href="http://en.wikipedia.org/wiki/HTML">HTML</a> discovery is supported by almost all the identifiers.' ),
:results => r = {
"HTML" => Uri.html_discovery(:any).count * 100.0 / Uri.count,
"Yadis" => Uri.xrds_discovery(:any).count * 100.0 / Uri.count
},

{ :title => t = 'OpenID Providers (%)',
:description => ( brief? ?
"Most common providers used by OpenID URIs" :
'The list of OpenID providers is smaller. Many people choose to relay in an external OpenID provider, instead of hosting their own. <a href="http://myopenid.com/">myOpenID</a> is the most popular OpenID provider, followed by <a href="http://blogspot.com/">Blogger</a>. Other providers include <a href="http://livejournal.com/">LiveJournal</a>, <a href="http://verisignlabs.com/">Verisign</a> and <a href="http://claimid.com/">ClaimID</a>.' ),
:results => r = provider_results,
:image => bar(:title => t,
:data => r.values,
:data => r.last.map(&:last).flatten,
:axis_with_labels => "x,y",
:axis_labels => [ r.keys, (0..4).map{ |n| n * 25 } ],
:axis_labels => [ [0, 100 ], r.last.map(&:first).flatten.reverse ],
:max_value => 100,
:size => (brief? ? nil : "548x#{ r.last.count * 25 + 70 }"),
:encoding => 'extended',
:bar_width_and_spacing => { :width => 50, :spacing => 30 }),
:details => r.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last }%"
d << "</p>"
d
end
},
{
:title => t = "OpenID Protocol Versions in HTML discovery",
:description => ( brief? ?
'Distribution of OpenID versions announced by HTML' :
'Former versions of the OpenID protocol are far more popular in HTML discovery.' ),
:results => r = {
"v1, v1.1" => Uri.html_discovery(:only_1).count,
"v2" => Uri.html_discovery(:only_2).count,
"all" => Uri.html_discovery(:both).count
},
:image => pie(:title => t,
:data => r.values,
:legend => r.keys),
:details => r.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last * 100.0 / Uri.html_discovery(:any).count }%"
d << "</p>"
d
end
},
{
:title => t = "OpenID Protocol Versions in Yadis discovery",
:description => ( brief? ?
'Distribution of OpenID versions announced by Yadis' :
'Support for OpenID 2.0 is much more frequent in Yadis discovery. More than 75% of the identifiers supports it besides former protocol versions.' ),
:results => r = {
"v1, v1.1" => Uri.xrds_discovery(:only_1).count,
"v2" => Uri.xrds_discovery(:only_2).count,
"all" => Uri.xrds_discovery(:both).count
},
:image => pie(:title => t,
:data => r.values,
:legend => r.keys),
:details => r.inject("") do |d, r|
:orientation => 'h'),
:details => r.last.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last * 100.0 / Uri.xrds_discovery(:any).count }%"
d << "<strong>#{ r.first }</strong>: #{ r.last }"
d << "</p>"
d
end
},

{
:title => t = 'Web Standards (%)',
:description => ( brief? ?
Expand Down Expand Up @@ -155,7 +104,7 @@ def build_graphs
:title => t = 'Microformats (%)',
:description => ( brief? ?
'Microformat types found in OpenID\'s HTML' :
'This graph shows the most frequent <a href="http://microformats.org/">Microformats</a> found in the HTML of OpenID identifiers. <a href="http://microformats.org/wiki/rel-tag">RelTag</a> is the most popular. <a href="http://microformats.org/wiki/hcard">hCard</a> follows, something foreseeable as it is the format for personal data. XFN and Adr are also common, related with contacts and address respectively.' ),
'This graph shows the most frequent <a href="http://microformats.org/">Microformats</a> found in the HTML of OpenID identifiers. <a href="http://microformats.org/wiki/rel-tag">RelTag</a> is the most popular. <a href="http://microformats.org/wiki/hcard">hCard</a> follows, something foreseeable as it is the Microformat for personal data. <a href="http://microformats.org/wiki/xfn">XFN</a> and <a href="http://microformats.org/wiki/adr">Adr</a> are also common, related with contacts and address respectively.' ),
:results => r = microformats_results,
:image => bar(:title => t,
:data => r.map(&:last),
Expand All @@ -175,7 +124,7 @@ def build_graphs
:title => t = 'hCard vs FOAF (%)',
:description => ( brief? ?
'Two ways of format personal information, HTML semantic markup and Semantic Web' :
'OpenID identifier resources usually provide information about the personnas behind them. There are a couple of formats suitable for this. <a href="http://microformats.org/wiki/hcard">hCard</a> is the <a href="http://microformats.org/">Microformat</a> adaptation of vCard. It is the most popular. On the other hand, <a href="http://www.foaf-project.org/">FOAF</a> is the Semantic Web vocabulary for personal data.' ),
'OpenID identifier resources usually also provide information about the personnas behind them. There are a couple of formats suitable for this. <a href="http://microformats.org/wiki/hcard">hCard</a> is the <a href="http://microformats.org/">Microformat</a> adaptation of <a href="http://en.wikipedia.org/wiki/VCard">vCard</a>. It is the most popular. On the other hand, <a href="http://www.foaf-project.org/">FOAF</a> is the <a href="http://en.wikipedia.org/wiki/Semantic_Web">Semantic Web</a> vocabulary for personal data.' ),
:results => r = {
"FOAF" => Uri.foaf(true).count * 100.0 / Uri.count,
"hCard" => Uri.microformats('HCard').count * 100.0 / Uri.count
Expand All @@ -195,65 +144,114 @@ def build_graphs
d
end
},

{
:title => t = "XRDS service types (%)",
:title => t = 'Deployed OpenID Protocol Versions',
:description => ( brief? ?
'Most common service types announced in XRDS files' :
'This graph shows the most common service types announced in XRDS files. OpenID protocol uses Yadis as a way to discover OpenID services. The information is described in <a href="http://en.wikipedia.org/wiki/XRDS">XRDS</a>, a XML format for discovering services associated with a resource.<br/>OpenID authentication (1.0, <a href="http://openid.net/specs/openid-authentication-1_1.html">1.1</a>, <a href="http://openid.net/specs/openid-authentication-2_0.html">2.0</a>) and OpenID Simple Registration Extension (<a href="http://openid.net/specs/openid-simple-registration-extension-1_0.html">1.0</a>, <a href="http://openid.net/specs/openid-simple-registration-extension-1_1-01.html">1.1</a>) are main services announced by OpenID identifiers supporting XRDS. Other popular services include <a href="http://openid.net/specs/openid-provider-authentication-policy-extension-1_0.html">OpenID PAPE Phishing Resistant Authentication</a> and <a href="http://openid.net/specs/openid-attribute-exchange-1_0.html">OpenID Attribute Exchange</a>. The rest of services are less common, but are all related to OpenID.' ),
:results => r = xrds_results,
"OpenID protocol versions currently deployed and announced by identifiers" :
'OpenID protocol currently defines three versions. <a href="http://openid.net/specs/openid-authentication-1_1.html">Version 1.1</a> was published on May 2006. <a href="http://openid.net/specs/openid-authentication-2_0.html">Version 2.0</a> a year and half later. Most of OpenID identifiers do not support the lastest version of the protocol. Among the identifiers supporting it, most of them maintain compatibility with former versions.' ),
:results => r = {
"v1, v1.1" => Uri.openid_version(:only_1).count,
"v2" => Uri.openid_version(:only_2).count,
"all" => Uri.openid_version(:both).count
},

:image => pie(:title => t,
:data => r.values,
:legend => r.keys),
:details => r.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last * 100.0 / Uri.openid_version(:any).count }"
d << "</p>"
d
end
},
{
:title => t = 'OpenID Discovery Technologies (%)',
:description => ( brief? ?
'OpenID can be discovered both by a HTML header link or using Yadis discovery' :
'OpenID specifications define two ways for discovering the OpenID service upon the identifier and starting protocol requests. Through the specifications prioritize <a href="http://en.wikipedia.org/wiki/Yadis">Yadis</a> as the first option to be tried, it is only supported by half of the identifiers. On the other hand, <a href="http://en.wikipedia.org/wiki/HTML">HTML</a> discovery is supported by almost all the identifiers.' ),
:results => r = {
"HTML" => Uri.html_discovery(:any).count * 100.0 / Uri.count,
"Yadis" => Uri.xrds_discovery(:any).count * 100.0 / Uri.count
},

:image => bar(:title => t,
:data => r.last.map(&:last),
:data => r.values,
:axis_with_labels => "x,y",
:axis_labels => [ [0, 100], r.last.map(&:first).reverse ],
:axis_labels => [ r.keys, (0..4).map{ |n| n * 25 } ],
:max_value => 100,
:size => (brief? ? nil : "548x#{ r.last.count * 25 + 70 }"),
:encoding => 'extended',
:orientation => 'h'),
:details => r.first.inject("") do |d, r|
:bar_width_and_spacing => { :width => 50, :spacing => 30 }),
:details => r.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last }"
d << "<strong>#{ r.first }</strong>: #{ r.last }%"
d << "</p>"
d
end
},
{
:title => t = "OpenID Protocol Versions in HTML discovery",
:description => ( brief? ?
'Distribution of OpenID versions announced by HTML' :
'Former versions of the OpenID protocol are far more popular in HTML discovery.' ),
:results => r = {
"v1, v1.1" => Uri.html_discovery(:only_1).count,
"v2" => Uri.html_discovery(:only_2).count,
"all" => Uri.html_discovery(:both).count
},
:image => pie(:title => t,
:data => r.values,
:legend => r.keys),
:details => r.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last * 100.0 / Uri.html_discovery(:any).count }%"
d << "</p>"
d
end

},
{
:title => t = 'OpenID URI Domains (%)',
:title => t = "OpenID Protocol Versions in Yadis discovery",
:description => ( brief? ?
'Most common domains used in OpenID URIs' :
'This graph analyzes the domains most used as OpenID identifiers. There is a strong tendency to use own customized domains, usually personal blogs and homepages. <a href="http://blogspot.com/">Blogger</a> and <a href="http://myopenid.com/">myOpenID</a> are the most popular providers. Other blogging platforms follow, including <a href="http://wordpress.com/">Wordpress</a> and <a href="http://livejournal.com/">LiveJournal</a>.' ),
:results => r = domain_results,
:image => bar(:title => t,
:data => r.last.map(&:last).flatten,
:axis_with_labels => "x,y",
:axis_labels => [ [0, 100 ], r.last.map(&:first).flatten.reverse ],
:max_value => 100,
:size => (brief? ? nil : "548x#{ r.last.count * 25 + 70 }"),
:encoding => 'extended',
:orientation => 'h'),
'Distribution of OpenID versions announced by Yadis' :
'Support for OpenID 2.0 is much more frequent in <a href="http://en.wikipedia.org/wiki/Yadis">Yadis</a> discovery. More than 75% of the identifiers supports it besides former protocol versions.' ),
:results => r = {
"v1, v1.1" => Uri.xrds_discovery(:only_1).count,
"v2" => Uri.xrds_discovery(:only_2).count,
"all" => Uri.xrds_discovery(:both).count
},
:image => pie(:title => t,
:data => r.values,
:legend => r.keys),
:details => r.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last * 100.0 / Uri.xrds_discovery(:any).count }%"
d << "</p>"
d
end
},

{ :title => t = 'OpenID Providers (%)',
{
:title => t = "XRDS service types (%)",
:description => ( brief? ?
"Most common providers used by OpenID URIs" :
'The list of OpenID providers is wider, as many people choose to relay in an external OpenID provider, instead of hosting their own. <a href="http://myopenid.com/">myOpenID</a> is by far the most popular OpenID provider. Other providers include <a href="http://livejournal.com/">LiveJournal</a>, <a href="http://blogspot.com/">Blogger</a>, <a href="http://verisignlabs.com/">Verisign</a> and <a href="http://claimid.com/">ClaimID</a>' ),
:results => r = provider_results,
'Most common service types announced in XRDS files' :
'This graph shows the most common service types announced in <a href="http://en.wikipedia.org/wiki/XRDS">XRDS</a> files. OpenID protocol uses <a href="http://en.wikipedia.org/wiki/Yadis">Yadis</a> as a way to discover OpenID services. The information is described in <a href="http://en.wikipedia.org/wiki/XRDS">XRDS</a>, a XML format for discovering services associated with a resource.<br/>OpenID authentication (1.0, <a href="http://openid.net/specs/openid-authentication-1_1.html">1.1</a>, <a href="http://openid.net/specs/openid-authentication-2_0.html">2.0</a>) and OpenID Simple Registration Extension (<a href="http://openid.net/specs/openid-simple-registration-extension-1_0.html">1.0</a>, <a href="http://openid.net/specs/openid-simple-registration-extension-1_1-01.html">1.1</a>) are the main services announced by OpenID identifiers supporting XRDS. Other popular services include <a href="http://openid.net/specs/openid-provider-authentication-policy-extension-1_0.html">OpenID PAPE Phishing Resistant Authentication</a> and <a href="http://openid.net/specs/openid-attribute-exchange-1_0.html">OpenID Attribute Exchange</a>. The rest of services are less common, but are all related to OpenID.' ),
:results => r = xrds_results,
:image => bar(:title => t,
:data => r.last.map(&:last).flatten,
:data => r.last.map(&:last),
:axis_with_labels => "x,y",
:axis_labels => [ [0, 100 ], r.last.map(&:first).flatten.reverse ],
:axis_labels => [ [0, 100], r.last.map(&:first).reverse ],
:max_value => 100,
:size => (brief? ? nil : "548x#{ r.last.count * 25 + 70 }"),
:encoding => 'extended',
:orientation => 'h'),
:details => r.last.inject("") do |d, r|
:details => r.first.inject("") do |d, r|
d << "<p>"
d << "<strong>#{ r.first }</strong>: #{ r.last }"
d << "</p>"
d
end
}

}
]
end

Expand Down Expand Up @@ -337,8 +335,19 @@ def provider_results
r_count.last(5) :
r_count.select{ |i| i.last > total * 0.01 } )


r = r_count.inject({}){ |h, i| h[i.first] = i.last * 100.0 / total; h }
r["other"] = ( total - r_count.inject(0){ |sum, i| sum + i.last } ) * 100.0 / total

# This is awfully designed and should be done by the database
popular_providers = r_count.map(&:first).flatten
other_providers = UriProperty.openid_providers - popular_providers

other_uris =
Uri.all.select{ |u| u.uri_property.openid_providers.present? &&
( u.uri_property.openid_providers & other_providers ).any? }

r["other"] = other_uris.size * 100.0 / total

[ r, r.sort{ |a, b| b.last <=> a.last } ]
end
end
1 change: 0 additions & 1 deletion app/models/uri.rb
Expand Up @@ -18,7 +18,6 @@ class Uri
:joins => :uri_property }
}


WebStandards .each do |p|
eval <<-EOS
named_scope :#{ p }, lambda { |#{ p }|
Expand Down

0 comments on commit ad87b2d

Please sign in to comment.