-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83cb915
commit 83f05ca
Showing
35 changed files
with
1,402 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
== 1.0.0 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
require "authlogic" | ||
require "authlogic_openid" | ||
require "authlogic_openid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
require File.dirname(__FILE__) + '/test_helper.rb' | ||
|
||
class ActsAsAuthenticTest < ActiveSupport::TestCase | ||
def test_included | ||
assert User.send(:acts_as_authentic_modules).include?(AuthlogicOpenid::ActsAsAuthentic::Methods) | ||
assert_equal :validate_password_with_openid?, User.validates_length_of_password_field_options[:if] | ||
assert_equal :validate_password_with_openid?, User.validates_confirmation_of_password_field_options[:if] | ||
assert_equal :validate_password_with_openid?, User.validates_length_of_password_confirmation_field_options[:if] | ||
end | ||
|
||
def test_password_not_required_on_create | ||
user = User.new | ||
user.login = "sweet" | ||
user.email = "a@a.com" | ||
user.openid_identifier = "https://me.yahoo.com/a/9W0FJjRj0o981TMSs0vqVxPdmMUVOQ--" | ||
assert !user.save # because we are redirecting, the user was NOT saved | ||
assert redirecting_to_yahoo? | ||
end | ||
|
||
def test_password_required_on_create | ||
user = User.new | ||
user.login = "sweet" | ||
user.email = "a@a.com" | ||
assert !user.save | ||
assert user.errors.on(:password) | ||
assert user.errors.on(:password_confirmation) | ||
end | ||
|
||
def test_password_not_required_on_update | ||
ben = users(:ben) | ||
assert_nil ben.crypted_password | ||
assert ben.save | ||
end | ||
|
||
def test_password__required_on_update | ||
ben = users(:ben) | ||
ben.openid_identifier = nil | ||
assert_nil ben.crypted_password | ||
assert !ben.save | ||
assert ben.errors.on(:password) | ||
assert ben.errors.on(:password_confirmation) | ||
end | ||
|
||
def test_validates_uniqueness_of_openid_identifier | ||
u = User.new(:openid_identifier => "bens_identifier") | ||
assert !u.valid? | ||
assert u.errors.on(:openid_identifier) | ||
end | ||
|
||
def test_setting_openid_identifier_changed_persistence_token | ||
ben = users(:ben) | ||
old_persistence_token = ben.persistence_token | ||
ben.openid_identifier = "new" | ||
assert_not_equal old_persistence_token, ben.persistence_token | ||
end | ||
|
||
def test_invalid_openid_identifier | ||
u = User.new(:openid_identifier => "%") | ||
assert !u.valid? | ||
assert u.errors.on(:openid_identifier) | ||
end | ||
|
||
def test_blank_openid_identifer_gets_set_to_nil | ||
u = User.new(:openid_identifier => "") | ||
assert_nil u.openid_identifier | ||
end | ||
|
||
def test_updating_with_openid | ||
ben = users(:ben) | ||
ben.openid_identifier = "https://me.yahoo.com/a/9W0FJjRj0o981TMSs0vqVxPdmMUVOQ--" | ||
assert !ben.save # because we are redirecting | ||
assert redirecting_to_yahoo? | ||
end | ||
|
||
def test_updating_without_openid | ||
ben = users(:ben) | ||
ben.openid_identifier = nil | ||
ben.password = "test" | ||
ben.password_confirmation = "test" | ||
assert ben.save | ||
assert !redirecting_to_yahoo? | ||
end | ||
|
||
def test_updating_without_validation | ||
ben = users(:ben) | ||
ben.openid_identifier = "https://me.yahoo.com/a/9W0FJjRj0o981TMSs0vqVxPdmMUVOQ--" | ||
assert ben.save(false) | ||
assert !redirecting_to_yahoo? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ben: | ||
login: bjohnson | ||
persistence_token: 6cde0674657a8a313ce952df979de2830309aa4c11ca65805dd00bfdc65dbcc2f5e36718660a1d2e68c1a08c276d996763985d2f06fd3d076eb7bc4d97b1e317 | ||
single_access_token: <%= Authlogic::Random.friendly_token %> | ||
perishable_token: <%= Authlogic::Random.friendly_token %> | ||
openid_identifier: bens_identifier | ||
email: bjohnson@binarylogic.com | ||
first_name: Ben | ||
last_name: Johnson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
* Fake HTTP method from OpenID server since they only support a GET. Eliminates the need to set an extra route to match the server's reply. [Josh Peek] | ||
|
||
* 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] | ||
|
||
* An invalid identity url passed through authenticate_with_open_id will no longer raise an InvalidOpenId exception. Instead it will return Result[:missing] to the completion block. | ||
|
||
* Allow a return_to option to be used instead of the requested url [Josh Peek] | ||
|
||
* Updated plugin to use Ruby OpenID 2.x.x [Josh Peek] | ||
|
||
* Tied plugin to ruby-openid 1.1.4 gem until we can make it compatible with 2.x [DHH] | ||
|
||
* Use URI instead of regexps to normalize the URL and gain free, better matching #8136 [dkubb] | ||
|
||
* Allow -'s in #normalize_url [Rick] | ||
|
||
* remove instance of mattr_accessor, it was breaking tests since they don't load ActiveSupport. Fix Timeout test [Rick] | ||
|
||
* Throw a InvalidOpenId exception instead of just a RuntimeError when the URL can't be normalized [DHH] | ||
|
||
* Just use the path for the return URL, so extra query parameters don't interfere [DHH] | ||
|
||
* 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] | ||
|
||
* Added normalize_url and applied it to all operations going through the plugin [DHH] | ||
|
||
* Removed open_id? as the idea of using the same input box for both OpenID and username has died -- use using_open_id? instead (which checks for the presence of params[:openid_url] by default) [DHH] | ||
|
||
* Added OpenIdAuthentication::Result to make it easier to deal with default situations where you don't care to do something particular for each error state [DHH] | ||
|
||
* Stop relying on root_url being defined, we can just grab the current url instead [DHH] |
Oops, something went wrong.