dlindahl / omniauth-cas

A CAS OmniAuth Strategy
MIT License
88 stars 79 forks source link

Problem with ticket callback #38

Open marcello opened 9 years ago

marcello commented 9 years ago

---- Infos ---- $ gem list|grep omniauth omniauth (1.2.2) omniauth-cas (1.1.0) omniauth-shibboleth (1.2.1)

---- Configs ---- RAILS_APP/config/initializers/omniauth.rb Rails.application.config.middleware.use OmniAuth::Builder do provider :cas, url: 'https://ufgnet.ufg.br/cas', disable_ssl_verification: true, service_validate_url: '/cas/serviceValidade' end

---- Log Error ---- Started GET "/auth/cas/callback?url&ticket=ST-104523-pQP0pOvmEzChiNdYuomg-cas.ufg.br" for 200.137.222.222 at 2015-08-21 09:17:46 -0300

NoMethodError - undefined method merge' for nil:NilClass: omniauth-cas (1.1.0) lib/omniauth/strategies/cas.rb:194:infetch_raw_info' omniauth-cas (1.1.0) lib/omniauth/strategies/cas.rb:84:in callback_phase' omniauth (1.2.2) lib/omniauth/strategy.rb:227:incallback_call' omniauth (1.2.2) lib/omniauth/strategy.rb:184:in call!' omniauth (1.2.2) lib/omniauth/strategy.rb:164:incall' omniauth (1.2.2) lib/omniauth/builder.rb:59:in call' meta_request (0.3.4) lib/meta_request/middlewares/app_request_handler.rb:13:incall' meta_request (0.3.4) lib/meta_request/middlewares/meta_request_handler.rb:13:in call' warden (1.2.3) lib/warden/manager.rb:35:inblock in call' warden (1.2.3) lib/warden/manager.rb:34:in call' rack (1.5.5) lib/rack/etag.rb:23:incall' rack (1.5.5) lib/rack/conditionalget.rb:25:in call' rack (1.5.5) lib/rack/head.rb:11:incall' actionpack (4.1.12) lib/action_dispatch/middleware/params_parser.rb:27:in call' actionpack (4.1.12) lib/action_dispatch/middleware/flash.rb:254:incall' rack (1.5.5) lib/rack/session/abstract/id.rb:225:in context' rack (1.5.5) lib/rack/session/abstract/id.rb:220:incall' actionpack (4.1.12) lib/action_dispatch/middleware/cookies.rb:562:in call' activerecord (4.1.12) lib/active_record/query_cache.rb:36:incall' activerecord (4.1.12) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in call' activerecord (4.1.12) lib/active_record/migration.rb:380:incall' actionpack (4.1.12) lib/action_dispatch/middleware/callbacks.rb:29:in block in call' activesupport (4.1.12) lib/active_support/callbacks.rb:82:inrun_callbacks' actionpack (4.1.12) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack (4.1.12) lib/action_dispatch/middleware/reloader.rb:73:incall' actionpack (4.1.12) lib/action_dispatch/middleware/remote_ip.rb:76:in call' better_errors (1.1.0) lib/better_errors/middleware.rb:84:inprotected_app_call' better_errors (1.1.0) lib/better_errors/middleware.rb:79:in better_errors_call' better_errors (1.1.0) lib/better_errors/middleware.rb:56:incall' rack-contrib (1.4.0) lib/rack/contrib/response_headers.rb:17:in call' meta_request (0.3.4) lib/meta_request/middlewares/headers.rb:16:incall' actionpack (4.1.12) lib/action_dispatch/middleware/debug_exceptions.rb:17:in call' actionpack (4.1.12) lib/action_dispatch/middleware/show_exceptions.rb:30:incall' railties (4.1.12) lib/rails/rack/logger.rb:38:in call_app' railties (4.1.12) lib/rails/rack/logger.rb:20:inblock in call' activesupport (4.1.12) lib/active_support/tagged_logging.rb:68:in block in tagged' activesupport (4.1.12) lib/active_support/tagged_logging.rb:26:intagged' activesupport (4.1.12) lib/active_support/tagged_logging.rb:68:in tagged' railties (4.1.12) lib/rails/rack/logger.rb:20:incall' actionpack (4.1.12) lib/action_dispatch/middleware/request_id.rb:21:in call' rack (1.5.5) lib/rack/methodoverride.rb:21:incall' rack (1.5.5) lib/rack/runtime.rb:17:in call' activesupport (4.1.12) lib/active_support/cache/strategy/local_cache_middleware.rb:26:incall' rack (1.5.5) lib/rack/lock.rb:17:in call' actionpack (4.1.12) lib/action_dispatch/middleware/static.rb:84:incall' rack (1.5.5) lib/rack/sendfile.rb:112:in call' railties (4.1.12) lib/rails/engine.rb:514:incall' railties (4.1.12) lib/rails/application.rb:144:in call' thin (1.6.3) lib/thin/connection.rb:86:inblock in pre_process' thin (1.6.3) lib/thin/connection.rb:84:in pre_process' thin (1.6.3) lib/thin/connection.rb:53:inprocess' thin (1.6.3) lib/thin/connection.rb:39:in receive_data' eventmachine (1.0.8) lib/eventmachine.rb:193:inrun' thin (1.6.3) lib/thin/backends/base.rb:73:in start' thin (1.6.3) lib/thin/server.rb:162:instart' thin (1.6.3) lib/thin/controllers/controller.rb:87:in start' thin (1.6.3) lib/thin/runner.rb:200:inrun_command' thin (1.6.3) lib/thin/runner.rb:156:in run!' thin (1.6.3) bin/thin:6:in<top (required)>' /home/weby-teste/.rbenv/versions/2.1.2/bin/thin:23:in `

'

lucasperin commented 9 years ago

I had this issue recently trying to configure my gitlab with my university's cas server.

The problem was with

service_validate_url: '/cas/serviceValidade'

Apparently its not validating the ticket with the server. When parsing the results, it returns Nil and breaks when it tries to merge nil result with the "fetch_raw" from other sources.

try using removing 'cas'

service_validate_url: '/serviceValidade'
marcello commented 9 years ago

Ok but same error. I tried check the ticket with URL browser and it works. Do you have another ideia?

lucasperin commented 9 years ago

You could try to print the xml response body. Make sure that the CAS server is responding with fail or success. There should be a response somewhat like this:

<?xml version="1.0"?>
<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
        <cas:authenticationSuccess>
                <cas:user>123123123</cas:user>
        </cas:authenticationSuccess>
</cas:serviceResponse>

If you don't get a response like this, raw_data will be set to NIL and then you get the undefined merge for NIL. My CAS server is using JSAIG, i need to validate my ticket with /samlValidate. Unfortunately this cas implementation still doesn't support that :(

dlindahl commented 8 years ago

I no longer have access to a CAS server and therefore am no longer fit to maintain this project.

If you would like to volunteer to be a maintainer of this project, please let me know by opening an Issue.