Skip to content

Commit

Permalink
Changed default identity url parameter from "openid_url" to "openid_i…
Browse files Browse the repository at this point in the history
…dentifier" as recommended in the OpenID 2.0 spec
  • Loading branch information
josh committed Jul 27, 2008
1 parent 8a47d6e commit 9efbd25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,3 +1,5 @@
* OpenID 2.0 recommends that forms should use the field name "openid_identifier" rather than "openid_url" [Josh Peek]

* Return open_id_response.display_identifier to the application instead of .endpoints.claimed_id. [nbibler]

* Add Timeout protection [Rick]
Expand Down
4 changes: 2 additions & 2 deletions README
Expand Up @@ -90,8 +90,8 @@ app/views/sessions/new.erb
</p>

<p>
<label for="openid_url">OpenID:</label>
<%= text_field_tag "openid_url" %>
<label for="openid_identifier">OpenID:</label>
<%= text_field_tag "openid_identifier" %>
</p>

<p>
Expand Down
14 changes: 11 additions & 3 deletions lib/open_id_authentication.rb
Expand Up @@ -83,13 +83,21 @@ def normalize_url(url)
OpenIdAuthentication.normalize_url(url)
end

# The parameter name of "openid_url" is used rather than the Rails convention "open_id_url"
# The parameter name of "openid_identifier" is used rather than the Rails convention "open_id_identifier"
# because that's what the specification dictates in order to get browser auto-complete working across sites
def using_open_id?(identity_url = params[:openid_url]) #:doc:
def using_open_id?(identity_url = params[:openid_identifier]) #:doc:
if params.has_key?(:openid_url)
puts '[OPENID] The conventional field name has changed from "openid_url" to "openid_identifier"'
end

!identity_url.blank? || params[:open_id_complete]
end

def authenticate_with_open_id(identity_url = params[:openid_url], options = {}, &block) #:doc:
def authenticate_with_open_id(identity_url = params[:openid_identifier], options = {}, &block) #:doc:
if params.has_key?(:openid_url)
puts '[OPENID] The conventional field name has changed from "openid_url" to "openid_identifier"'
end

if params[:open_id_complete].nil?
begin_open_id_authentication(identity_url, options, &block)
else
Expand Down

0 comments on commit 9efbd25

Please sign in to comment.