rubycas / rubycas-server

Provides single sign-on authentication for web applications, implementing the server-end of Jasig's CAS protocol.
http://rubycas.github.com
Other
628 stars 270 forks source link

Issues authenticating with remote devise #200

Open mylanconnolly opened 10 years ago

mylanconnolly commented 10 years ago

Hello, I saw that support was recently added for doing remote devise authenticators. I was ecstatic to see that it was accepted, so I tried it out.

Currently, my infrastructure is laid out as follows:

I have an app at http://localhost:4000 set up as a rubycas_client. When users go to any URL, it does the rubycas thing. Redirects work perfect. Its URL is https://localhost:443.

Where I run into problems is in the response back from Devise (or maybe the handling of the response?). My remote Devise seems to be working fine, as shown by some sample logging output:

Started POST "/users/sign_in.json" for 127.0.0.1 at 2014-02-25 16:59:14 -0500
Processing by Devise::SessionsController#create as JSON
  Parameters: {"user"=>{"email"=>"mconnolly@iotrak.com", "password"=>"[FILTERED]"}, "session"=>{"user"=>{"email"=>"mconnolly@iotrak.com", "password"=>"[FILTERED]"}}}
  MOPED: 127.0.0.1:27017 COMMAND      database=admin command={:ismaster=>1} runtime: 40.4029ms
  MOPED: 127.0.0.1:27017 QUERY        database=user_management_development collection=users selector={"$query"=>{"email"=>"mconnolly@iotrak.com"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 1.0539ms
  MOPED: 127.0.0.1:27017 UPDATE       database=user_management_development collection=users selector={"_id"=>BSON::ObjectId('530ceb1b7562754033000000')} update={"$set"=>{"last_sign_in_at"=>2014-02-25 21:53:13 UTC, "current_sign_in_at"=>2014-02-25 21:59:14 UTC, "sign_in_count"=>16, "updated_at"=>2014-02-25 21:59:14 UTC}} flags=[]
                         COMMAND      database=user_management_development command={:getlasterror=>1, :w=>1} runtime: 1.2601ms
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Completed 201 Created in 180ms (Views: 2.4ms)

However, I get the following error on the rubycas server end:

NoMethodError at /login
undefined method `has_key?' for nil:NilClass

    file: remote_devise.rb
    location: block in validate
    line: 105

It references this block of code (starting at line 102):

          @extra_attributes = json[@options[:devise][:model].to_s]

          if @extra_attributes.has_key?('username')
            @extra_attributes['username_devise'] = @extra_attributes['username']
            @extra_attributes.delete('username')
          end

If someone could point me in the right direction I'd greatly appreciate it.

Thanks!

mitfik commented 10 years ago

Did you tried to setup extra_attributes in config file for that authenticator?

mylanconnolly commented 10 years ago

For right now, I have moved on to another project since I wanted to continue ahead, but I will certainly look into it when I get back around to it, thank you for the tip!

On 03/01/2014 04:46 PM, Robert Mitwicki wrote:

Did you tried to setup extra_attributes in config file for that authenticator?

— Reply to this email directly or view it on GitHub https://github.com/rubycas/rubycas-server/issues/200#issuecomment-36437757.