Maheswaran спросил: 03 ноября 2018 в 08:35 в: ruby-on-rails

Здесь я реализовал собственную стратегию единого входа в omniauth-oauth2. Я создал собственный gem sso и успешно установил пакет. Но когда я пытаюсь запустить сервер, возникает ошибка, показывающая, что не удалось найти подходящую стратегию для: sso. Вам может понадобиться установить дополнительный гем (например, omniauth-sso).

В файле гема:

gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-sso', path: "/Users/maheswaran/Documents/Intern/omniauth-sso"

Initializers / omniauth.rb:

OmniAuth.config.logger = Rails.loggerCUSTOM_PROVIDER_URL = 'http://app.10.0.1.106.xip.io:3000'Rails.application.config.middleware.use OmniAuth::Builder do
  provider :sso, "123456", "qwerty"
end
Ошибка:
/Users/maheswaran/.gem/ruby/2.4.0/gems/omniauth-1.8.1/lib/omniauth/builder.rb:54:in `rescue in provider': Could not find matching strategy for :sso. You may need to install an additional gem (such as omniauth-sso). (LoadError)
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/omniauth-1.8.1/lib/omniauth/builder.rb:51:in `provider'
    from /Users/maheswaran/Documents/Intern/config/initializers/omniauth.rb:11:in `block in <top (required)>'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `initialize'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/omniauth-1.8.1/lib/omniauth/builder.rb:6:in `initialize'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/actionpack-5.2.0/lib/action_dispatch/middleware/stack.rb:37:in `new'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/actionpack-5.2.0/lib/action_dispatch/middleware/stack.rb:37:in `build'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/actionpack-5.2.0/lib/action_dispatch/middleware/stack.rb:101:in `block in build'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/actionpack-5.2.0/lib/action_dispatch/middleware/stack.rb:101:in `each'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/actionpack-5.2.0/lib/action_dispatch/middleware/stack.rb:101:in `inject'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/actionpack-5.2.0/lib/action_dispatch/middleware/stack.rb:101:in `build'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:510:in `block in app'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:506:in `synchronize'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:506:in `app'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `each'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `call'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
    from /Users/maheswaran/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
    from /Users/maheswaran/Documents/Intern/config/environment.rb:5:in `<top (required)>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `initialize'
    from config.ru:in `new'
    from config.ru:in `<main>'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:49:in `eval'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:40:in `parse_file'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/server.rb:319:in `build_app_and_options_from_config'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/server.rb:219:in `app'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:27:in `app'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/rack-2.0.5/lib/rack/server.rb:354:in `wrapped_app'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:51:in `start'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke'
    from /Users/maheswaran/.gem/ruby/2.4.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<top (required)>'
    from /Users/maheswaran/Documents/Intern/bin/rails:4:in `require'
    from /Users/maheswaran/Documents/Intern/bin/rails:4:in `<main>'

0 ответов