saml-idp / saml_idp

Ruby SAML Identity Provider, best used with Rails (though not required)
MIT License
263 stars 181 forks source link

undefined method `signed_message=' for #<SamlIdp::Configurator:0x00007f9b1e8ee4f8 #180

Closed siva-wal closed 2 years ago

siva-wal commented 2 years ago
undefined method `signed_message=' for #<SamlIdp::Configurator:0x00007f9b1e8ee4f8 @x509_certificate="-----BEGIN CERTIFICATE-----\\nMIIDaDCCAlACCQC2s9fqFXmluDANBgkqhkiG9w0BAQsFADB2MQswCQYDVQQGEwJJ\\nTjESMBAGA1UECAwJVGVsYW5nYW5hMQwwCgYDVQQHDANIWUQxDDAKBgNVBAoMA1dB\\nTDEMMAoGA1UECwwDV0FMMSkwJwYJKoZIhvcNAQkBFhpzaXZhZ29sbGFwYWxsaTg4\\nQGdtYWlsLmNvbTAeFw0yMjA3MDgwODU4MTZaFw0yMzA3MDgwODU4MTZaMHYxCzAJ\\nBgNVBAYTAklOMRIwEAYDVQQIDAlUZWxhbmdhbmExDDAKBgNVBAcMA0hZRDEMMAoG\\nA1UECgwDV0FMMQwwCgYDVQQLDANXQUwxKTAnBgkqhkiG9w0BCQEWGnNpdmFnb2xs\\nYXBhbGxpODhAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC\\nAQEAschkXHL41Qiv4++Ky1+rC+p9q3wWVBt1biFNZIuKJkZ4ojzV0VvgEh5yg6HN\\nIP4FVYQWyEFbzZcyUlhRsmbfULVcamtuxlsfgDvAmYL+7qwJ9ASJnNwmWvxRKQyn\\nv/vof3X7erfvIn2023JI6zzm+DrbHR38L2Et7tQvIJt1B5754MLI2SD6r2XAK8wl\\nbZgkO+10WO4YhsRrMFvXERIVEntSg3eg5MWA076o0AEBJLNQKtu5Yzl80483fN1f\\nEeXo18UoQY4JMHAmgJBR9pc02lnnRArCLdphH8JZKWEcT4RZsH34ZJOMWt6/9cjC\\nr0fUmzcPR8eIAdlUF7B2P+YRNQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBA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id_generator=#<Proc:0x00007f9b1e8ee408 /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/saml_idp-0.14.0/lib/saml_idp/configurator.rb:30 (lambda)>, @service_provider=#<OpenStruct finder=#<Proc:0x00007f9b1e8ee2f0 /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/saml_idp-0.14.0/lib/saml_idp/configurator.rb:32 (lambda)>, metadata_persister=#<Proc:0x00007f9b1e8ede68 /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/saml_idp-0.14.0/lib/saml_idp/configurator.rb:33 (lambda)>, persisted_metadata_getter=#<Proc:0x00007f9b1e8edad0 /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/saml_idp-0.14.0/lib/saml_idp/configurator.rb:34 (lambda)>>, @session_expiry=86400, @attributes={}, @organization_name="WAL", @organization_url="http://localhost:3000", @base_saml_location="http://localhost:3000/saml", @single_logout_service_post_location="http://localhost:3000/saml/logout", @single_logout_service_redirect_location="http://localhost:3000/saml/logout", @attribute_service_location="http://localhost:3000/saml/attributes", @single_service_post_location="http://localhost:3000/saml/auth"> (NoMethodError)

from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/saml_idp-0.14.0/lib/saml_idp.rb:19:in `configure'
    from /Users/sivagollapalli/identity_provider/config/initializers/saml_idp.rb:1:in `<main>'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/engine.rb:667:in `block in load_config_initializer'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/activesupport-7.0.3/lib/active_support/notifications.rb:208:in `instrument'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/engine.rb:666:in `load_config_initializer'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/engine.rb:619:in `each'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/engine.rb:619:in `block in <class:Engine>'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/initializable.rb:32:in `instance_exec'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/initializable.rb:32:in `run'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/initializable.rb:50:in `each'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/initializable.rb:50:in `tsort_each_child'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `call'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `call'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
    from /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/initializable.rb:60:in `run_initializers'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/application.rb:372:in `initialize!'
    from /Users/sivagollapalli/identity_provider/config/environment.rb:5:in `<main>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/builder.rb:116:in `eval'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/builder.rb:116:in `new_from_string'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/builder.rb:105:in `load_file'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/builder.rb:66:in `parse_file'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/server.rb:349:in `build_app_and_options_from_config'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/server.rb:249:in `app'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/server.rb:422:in `wrapped_app'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:36:in `start'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:143:in `block in perform'
    from <internal:kernel>:90:in `tap'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:134:in `perform'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/command/base.rb:87:in `perform'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/command.rb:48:in `invoke'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/railties-7.0.3/lib/rails/commands.rb:18:in `<main>'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from bin/rails:4:in `<main>'

After debugging I am seeing inlib/saml_idp/configurator.rb respective signed_message attr_accessor is missing. Let me your thoughts. I would like to raise PR.

Zogoo commented 2 years ago

Thanks for raising this issue. @siva-wal. It seems like our README contains the wrong information. If you want to sign your SAML Response, you can pass signed_message: true option when you generate the SAML response with encode_response method. I will fix our README.

Zogoo commented 2 years ago

README corrected with https://github.com/saml-idp/saml_idp/pull/185 PR