Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7115

Show
Ignore:
Timestamp:
06/25/07 16:29:26 (1 year ago)
Author:
david
Message:

Throw a InvalidOpenId exception instead of just a RuntimeError when the URL can't be normalized [DHH]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/open_id_authentication/CHANGELOG

    r6514 r7115  
     1* Throw a InvalidOpenId exception instead of just a RuntimeError when the URL can't be normalized [DHH] 
     2 
     3* Just use the path for the return URL, so extra query parameters don't interfere [DHH] 
     4 
    15* Added a new default database-backed store after experiencing trouble with the filestore on NFS. The file store is still available as an option [DHH] 
    26 
  • plugins/open_id_authentication/lib/open_id_authentication.rb

    r6936 r7115  
    44  @@store = :db 
    55  mattr_accessor :store 
     6 
     7  class InvalidOpenId < StandardError 
     8  end 
    69 
    710  class Result 
     
    5659      "http://" + url + "/" 
    5760    else 
    58       raise "#{url} is not a correctly formatted OpenID address" 
     61      raise InvalidOpenId.new("#{url} is not an OpenID URL") 
    5962    end 
    6063  end 
     
    131134      open_id_response.redirect_url( 
    132135        request.protocol + request.host_with_port + "/", 
    133         open_id_response.return_to("#{request.url}?open_id_complete=1") 
     136        open_id_response.return_to("#{request.protocol + request.host_with_port + request.path}?open_id_complete=1") 
    134137      )      
    135138    end 
  • plugins/open_id_authentication/test/normalize_test.rb

    r6332 r7115  
    11require 'test/unit' 
     2require 'rubygems' 
     3require 'active_support' 
    24 
    35RAILS_ROOT = File.dirname(__FILE__) 
     
    2022    end 
    2123  end 
     24   
     25  def test_broken_open_id 
     26    assert_raises(InvalidOpenId) { normalize_url("=name") } 
     27  end 
    2228end