apokalipto / devise_saml_authenticatable

Devise SAML 2.0 authentication strategy
MIT License
296 stars 153 forks source link

Unable to map SAML response attributes to User attributes #234

Closed Coolvibes closed 1 year ago

Coolvibes commented 1 year ago

Hi, I'm using devise_saml_authenticatable version - 1.5.0 with ruby-2.0.0-p648 on Rails 4. I created a sample IdP connector on Onelogin following this wiki. Devise::SamlSessionsController#create first looks for the attribute-map.yml, if not added. Upon adding the attribute-map.yml, I get an error - undefined method `to_sym' for nil:NilClass - when I try to use any devise helpers(e.g. current_user, user_signed_in?) within my controller code. Format for my SAML attributes(I'm receiving - email, username, name) as per the SAML response I decoded is - urn:oasis:names:tc:SAML:2.0:attrname-format:basic - which would imply simple string values as keys. But I have also tried the other following versions of my attribute-map.yml as I'm just beginning to learn working with this protocol.

attribute-map.yml - 1

email: "email"
username: "username"
name: "name"

attribute-map.yml - 2

"urn:oasis:names:tc:SAML:2.0:attrname-format:email": "email"
"urn:oasis:names:tc:SAML:2.0:attrname-format:username": "username"
"urn:oasis:names:tc:SAML:2.0:attrname-format:name": "name"

attribute-map.yml - 3

"urn:mace:dir:attribute-def:email": "email"
"urn:mace:dir:attribute-def:username": "username"
"urn:mace:dir:attribute-def:name": "name"

I'm guessing there's some issue with attribute mapping to my User model fields, which are email, name, username. I am able to establish SSO login and receive a response. Please help, thank you!

adamstegman commented 1 year ago

@Coolvibes we don't support Ruby 2.0.0 or Rails 4, so I'd suspect that the issue is from using those old versions. What is the stacktrace from the error you saw?

Coolvibes commented 1 year ago

@adamstegman PFB:

Started GET "/" for 127.0.0.1 at 2023-03-08 14:13:53 +0530
Processing by WelcomeController#index as HTML
  Parameters: {"org_name"=>nil}
Completed 401 Unauthorized in 14ms (ActiveRecord: 0.0ms | Http: 0.0ms)

Started GET "/users/saml/sign_in" for 127.0.0.1 at 2023-03-08 14:13:53 +0530
Processing by Devise::SamlSessionsController#new as HTML
  Parameters: {"org_name"=>nil}
Created AuthnRequest: <samlp:AuthnRequest AssertionConsumerServiceURL='http://localhost:3000/users/saml/auth' Destination='https://oneops.onelogin.com/trust/saml2/http-post/sso/8005c7eb-b113-4261-a8ca-3f6ac78e3e67' ID='_1910327e-392c-450e-9453-fad5b5e1b67d' IssueInstant='2023-03-08T08:43:53Z' Version='2.0' xmlns:saml='urn:oasis:names:tc:SAML:2.0:assertion' xmlns:samlp='urn:oasis:names:tc:SAML:2.0:protocol'><saml:Issuer>https://<app_name>.onelogin.com/</saml:Issuer><samlp:NameIDPolicy AllowCreate='true' Format='urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'/></samlp:AuthnRequest>
Redirected to https://<app_name>.onelogin.com/trust/saml2/http-post/sso/8005c7eb-b113-4261-a8ca-3f6ac78e3e67?SAMLRequest=fZLNitswFIVfxTutFMlWHDsiDpgJhcC0DPPTRTdFkW8ag6zr6srTztuP7DAwXTQgEBLnOzo60o7M4EbdTvHiH%2BH3BBSzlghC7NHfoadpgPAE4bW38PJ437BLjKMWwqE17oIUtZJSiikRJGYvYZIVyw7JqPdmdrkylCD0gCOt0uTwV%2B9XFgcRw0RxIQsx6%2FiI85pQ1FKWtoITP%2BW54utik3NTW8PVeWNsVYOCTcWy46FhP%2FNtLlVRAVfbwvJ1KYFv16XiZ9OVpxLy06bqkpRogqOnaHxsWCELxWUa9bOs9VrpUv1g2fd0jyVzsZIs%2Bzs4T3oO17ApeI2GetLeDEA6Wv3Ufr3XSajNR2OfkfE2MwaMaNGx%2FW5W6yVd2N%2Fqaic%2BK3fXp%2FuWnI%2BHB3S9fcta5%2FDPXQAToWGpWmDZFwyDif%2FPkq%2FyZafv%2BHmRahhM79quC0DExP566r9%2FZP8O
Completed 302 Found in 6ms (ActiveRecord: 0.0ms | Http: 0.0ms)

Started POST "/users/saml/auth" for 127.0.0.1 at 2023-03-08 14:13:55 +0530
Processing by Devise::SamlSessionsController#create as HTML
  Parameters: {"RelayState"=>"http://localhost:3000/", "SAMLResponse"=>"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWw9InVybjpvYX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jZSIgeHNpOnR5cGU9InhzOnN0\r\ncmluZyI+TWVkaGE8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJp\r\nYnV0ZT48c2FtbDpBdHRyaWJ1dGUgTmFtZT0iZW1haWwiIE5hbWVGb3JtYXQ9\r\nInVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6\r\nYmFzaWMiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhtbG5zOnhzaT0iaHR0cDov\r\nL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTp0eXBl\r\nPSJ4czpzdHJpbmciPm1lZGhhLmJhbnNhbEB3YWxtYXJ0LmNvbTwvc2FtbDpB\r\ndHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0\r\nZSBOYW1lPSJ1c2VybmFtZSIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVz\r\nOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDpiYXNpYyI+PHNhbWw6QXR0\r\ncmlidXRlVmFsdWUgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAx\r\nL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnR5cGU9InhzOnN0cmluZyI+bWVk\r\naGFiYW5zYWw8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0\r\nZT48L3NhbWw6QXR0cmlidXRlU3RhdGVtZW50Pjwvc2FtbDpBc3NlcnRpb24+\r\nPC9zYW1scDpSZXNwb25zZT4KCg==\r\n", "org_name"=>nil}
Completed 500 Internal Server Error in 75ms (ActiveRecord: 0.0ms | Http: 0.0ms)

**NoMethodError (undefined method `to_sym' for nil:NilClass):
  app/controllers/application_controller.rb:558:in `check_username'

  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.8ms)
  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms)
  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.6ms)
  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (23.2ms)**

In the browser, it shows:

Screenshot 2023-03-08 at 4 31 17 PM

Appears on first use of any Devise helper.

Coolvibes commented 1 year ago

@adamstegman Also, I tried to debug this from within Devise::SamlSessionsController#create(by linking to my local gems and using debugger), which is essentially Devise::SessionsController#create and could not reach it. My debugger stops at all points within devise_saml_autheticatable, but not those within devise and even the Devise.saml_config object(RubySaml::Settings) comes out to be blank when I print it within devise_saml_autheticatable, even though all settings are present.

My config/initializers/devise.rb :

Devise.setup do |config|
  config.saml_configure do |settings|
    settings.assertion_consumer_service_url     = "http://localhost:3000/users/saml/auth"
    settings.issuer                             = "https://<app_name>.onelogin.com/"
    settings.idp_entity_id                      = "https://app.onelogin.com/saml/metadata/8005c7eb-b113-4261-a8ca-3f6ac78e3***"
    settings.idp_slo_target_url                 = "https://<app_name>.onelogin.com/trust/saml2/http-redirect/slo/2010424"
    settings.idp_sso_target_url                 = "https://<app_name>.onelogin.com/trust/saml2/http-post/sso/8005c7eb-b113-4261-a8ca-3f6ac78e3***"
    settings.idp_cert_fingerprint_algorithm     = "http://www.w3.org/2000/09/xmldsig#sha1"
    settings.idp_cert_fingerprint               = "82:7F:C6:96:91:A6:12:0E:1F:C3:28:43:15:F9:90:2D:0A:8C:D1:8F"
    settings.name_identifier_format             = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
  end

  config.saml_create_user = true
  config.saml_update_user = true
end
adamstegman commented 1 year ago

It may be more helpful if you run Rails with BACKTRACE=1 so we get the full backtrace, including gems.

Coolvibes commented 1 year ago

@adamstegman Full trace for above error:

Completed 500 Internal Server Error in 175ms (ActiveRecord: 0.0ms | Http: 0.0ms)

NoMethodError (undefined method `to_sym' for nil:NilClass):
  activerecord (4.1.10) lib/active_record/sanitization.rb:59:in `block in expand_hash_conditions_for_aggregates'
  activerecord (4.1.10) lib/active_record/sanitization.rb:58:in `each'
  activerecord (4.1.10) lib/active_record/sanitization.rb:58:in `expand_hash_conditions_for_aggregates'
  activerecord (4.1.10) lib/active_record/relation/query_methods.rb:950:in `build_where'
  activerecord (4.1.10) lib/active_record/relation/query_methods.rb:572:in `where!'
  activerecord (4.1.10) lib/active_record/relation/query_methods.rb:559:in `where'
  activerecord (4.1.10) lib/active_record/querying.rb:10:in `where'
  devise_saml_authenticatable (1.5.0) lib/devise_saml_authenticatable.rb:118:in `block in <module:Devise>'
  devise_saml_authenticatable (1.5.0) lib/devise_saml_authenticatable/model.rb:45:in `call'
  devise_saml_authenticatable (1.5.0) lib/devise_saml_authenticatable/model.rb:45:in `authenticate_with_saml'
  devise_saml_authenticatable (1.5.0) lib/devise_saml_authenticatable/strategy.rb:50:in `retrieve_resource'
  devise_saml_authenticatable (1.5.0) lib/devise_saml_authenticatable/strategy.rb:23:in `authenticate!'
  warden (1.2.7) lib/warden/strategies/base.rb:54:in `_run!'
  warden (1.2.7) lib/warden/proxy.rb:359:in `block in _run_strategies_for'
  warden (1.2.7) lib/warden/proxy.rb:354:in `each'
  warden (1.2.7) lib/warden/proxy.rb:354:in `_run_strategies_for'
  warden (1.2.7) lib/warden/proxy.rb:324:in `_perform_authentication'
  warden (1.2.7) lib/warden/proxy.rb:105:in `authenticate'
  devise (3.5.4) lib/devise/controllers/helpers.rb:124:in `current_user'
  devise (3.5.4) lib/devise/controllers/helpers.rb:120:in `user_signed_in?'
  app/controllers/application_controller.rb:559:in `check_username'
  activesupport (4.1.10) lib/active_support/callbacks.rb:429:in `block in make_lambda'
  activesupport (4.1.10) lib/active_support/callbacks.rb:161:in `call'
  activesupport (4.1.10) lib/active_support/callbacks.rb:161:in `block in halting'
  activesupport (4.1.10) lib/active_support/callbacks.rb:501:in `call'
  activesupport (4.1.10) lib/active_support/callbacks.rb:501:in `block in call'
  activesupport (4.1.10) lib/active_support/callbacks.rb:501:in `each'
  activesupport (4.1.10) lib/active_support/callbacks.rb:501:in `call'
  activesupport (4.1.10) lib/active_support/callbacks.rb:86:in `run_callbacks'
  actionpack (4.1.10) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (4.1.10) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.1.10) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
  activesupport (4.1.10) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.10) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.10) lib/active_support/notifications.rb:159:in `instrument'
  actionpack (4.1.10) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.1.10) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
  activerecord (4.1.10) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.1.10) lib/abstract_controller/base.rb:136:in `process'
  actionview (4.1.10) lib/action_view/rendering.rb:30:in `process'
  actionpack (4.1.10) lib/action_controller/metal.rb:196:in `dispatch'
  actionpack (4.1.10) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.1.10) lib/action_controller/metal.rb:232:in `block in action'
  actionpack (4.1.10) lib/action_dispatch/routing/route_set.rb:82:in `call'
  actionpack (4.1.10) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
  actionpack (4.1.10) lib/action_dispatch/routing/route_set.rb:50:in `call'
  actionpack (4.1.10) lib/action_dispatch/routing/mapper.rb:45:in `call'
  actionpack (4.1.10) lib/action_dispatch/journey/router.rb:73:in `block in call'
  actionpack (4.1.10) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.1.10) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.1.10) lib/action_dispatch/routing/route_set.rb:692:in `call'
  rack-attack (5.2.0) lib/rack/attack.rb:172:in `call'
  warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
  warden (1.2.7) lib/warden/manager.rb:35:in `catch'
  warden (1.2.7) lib/warden/manager.rb:35:in `call'
  rack (1.5.5) lib/rack/etag.rb:23:in `call'
  rack (1.5.5) lib/rack/conditionalget.rb:35:in `call'
  rack (1.5.5) lib/rack/head.rb:11:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/flash.rb:254:in `call'
  rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/cookies.rb:562:in `call'
  activerecord (4.1.10) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.1.10) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.1.10) lib/active_support/callbacks.rb:82:in `run_callbacks'
  actionpack (4.1.10) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.1.10) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.10) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.10) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.10) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.10) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.10) lib/rails/rack/logger.rb:20:in `call'
  quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
  request_store (1.5.0) lib/request_store/middleware.rb:19:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.5) lib/rack/runtime.rb:17:in `call'
  rack (1.5.5) lib/rack/lock.rb:17:in `call'
  actionpack (4.1.10) lib/action_dispatch/middleware/static.rb:84:in `call'
  rack (1.5.5) lib/rack/sendfile.rb:112:in `call'
  railties (4.1.10) lib/rails/engine.rb:514:in `call'
  railties (4.1.10) lib/rails/application.rb:144:in `call'
  rack (1.5.5) lib/rack/lock.rb:17:in `call'
  rack (1.5.5) lib/rack/content_length.rb:14:in `call'
  rack (1.5.5) lib/rack/handler/webrick.rb:60:in `service'
  /Users/m0b0d7e/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /Users/m0b0d7e/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /Users/m0b0d7e/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.1ms)
  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms)
  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.7ms)
  Rendered /Users/m0b0d7e/.rvm/gems/ruby-2.0.0-p648/gems/actionpack-4.1.10/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (166.4ms)