Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Mar 28, 2009
1 parent ad550b5 commit 1bead0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 7 additions & 4 deletions README.rdoc
Expand Up @@ -30,19 +30,22 @@ Authlogic OpenID is an extension of the Authlogic library to add OpenID support.

=== 2. Install the openid_authentication plugin

script/plugin install git://github.com/rails/open_id_authentication.git
$ script/plugin install git://github.com/rails/open_id_authentication.git
$ rake open_id_authentication:db:create

For more information on how to configure the plugin, checkout it's README: http://github.com/rails/open_id_authentication/tree/master

=== 3. Install the Authlogic Openid gem

sudo gem install authlogic-oid
$ sudo gem install authlogic-oid

Now add the gem dependency in your config:

config.gem "authlogic-oid", :lib => "authlogic_openid"

Or for older version of rails, install it as a plugin:

script/plugin install git://github.com/binarylogic/authlogic_openid.git
$ script/plugin install git://github.com/binarylogic/authlogic_openid.git

=== 4. Make sure you save your objects properly

Expand Down Expand Up @@ -75,7 +78,7 @@ It's that simple. For more information there is a great OpenID tutorial at: http

Now, here are my thoughts on the subject:

You are probably thinking: "Ben, you can't handle controller responsibilities in models". I would agree with you on that comment, because my personal opinion is that these are not controller responsibilities. The fact that OpenID authentication requires a redirect should not effect the location of the logic / code. It's all part of the authentication process, which is the entire purpose of this library. The logic that handles this process should be in it's own domain, which is the definition of the "M" in MVC. The "M" doesn't have to just be a data access layer, it's a place for domain logic.
You are probably thinking: "Ben, you can't handle controller responsibilities in models". I agree with you on that comment, but my personal opinion is that these are not controller responsibilities. The fact that OpenID authentication requires a redirect should not effect the location of the logic / code. It's all part of the authentication process, which is the entire purpose of this library. The logic that handles this process should be in it's own domain, which is the definition of the "M" in MVC. The "M" doesn't have to just be a data access layer, it's a place for domain logic.

What if you wanted to authenticate with OpenID in multiple controllers in your application? You would probably pull out the common code into a module and include it in the respective controllers. Even better, you might create a class that elegantly handles this process and then place it in your lib directory. That's exactly what this is.

Expand Down
6 changes: 1 addition & 5 deletions lib/authlogic_openid/acts_as_authentic.rb
Expand Up @@ -11,7 +11,7 @@ def self.included(klass)
klass.class_eval do
validates_uniqueness_of :openid_identifier, :scope => validations_scope, :if => :using_openid?
validate :validate_openid
[:validates_length_of_login_field_options, :validates_format_of_login_field_options,
[:validates_length_of_login_field_options, :validates_format_of_login_field_options, :validates_length_of_password_field_options,
:validates_confirmation_of_password_field_options, :validates_length_of_password_confirmation_field_options].each do |method|
send(method, send(method).merge(:unless => :using_openid?))
end
Expand Down Expand Up @@ -76,10 +76,6 @@ def openid_complete?
def authenticate_with_openid?
session_class.activated? && ((using_openid? && openid_identifier_changed?) || openid_complete?)
end

def redirecting_to_openid?
@redirecting_to_openid == true
end
end
end
end

0 comments on commit 1bead0e

Please sign in to comment.