rbCAS / CASino

CASino is a Ruby-based Single Sign-On solution supporting the CAS standard
MIT License
329 stars 189 forks source link

Net timeout error when trying to sign in. #180

Closed vizakenjack closed 7 years ago

vizakenjack commented 7 years ago

Hello. I used RubyCAS and now I try to migrate to CASino.

I have installed CASinoApp, it runs fine, I can login and logout. So I open my Rails app, it redirects to a Casino, then I type my email and password, and type "sign in". After that, it's loading for something for a long time and then shows an error.

Logs in my Rails app:

I, [2017-02-16T17:46:25.657535 #28572]  INFO -- : Started GET "/users/sign_in" for 46.188.121.104 at 2017-02-16 17:46:25 +0300
I, [2017-02-16T17:46:25.659215 #28572]  INFO -- : Processing by DmpCasController#new as HTML
I, [2017-02-16T17:46:25.659672 #28572]  INFO -- : Current user: Anonymous
I, [2017-02-16T17:46:25.667560 #28572]  INFO -- : Redirected to http://auth.mytestapp.com/login?service=http%3A%2F%2Frails.mytestapp.com%2Fusers%2Fservice
I, [2017-02-16T17:46:25.667744 #28572]  INFO -- : Completed 302 Found in 8ms (ActiveRecord: 0.0ms)
I, [2017-02-16T17:46:27.244701 #28572]  INFO -- : Started GET "/users/service?ticket=ST-14872563871889-u80GnDc3lgfz50jSy7Jx3NBcKxvOqn5PFkTop0XK" for 46.188.121.104 at 2017-02-16 17:46:27 +0300
I, [2017-02-16T17:46:27.245653 #28572]  INFO -- : Processing by DmpCasController#service as HTML
I, [2017-02-16T17:46:27.245683 #28572]  INFO -- :   Parameters: {"ticket"=>"ST-14872563871889-u80GnDc3lgfz50jSy7Jx3NBcKxvOqn5PFkTop0XK"}
D, [2017-02-16T17:46:27.247939 #28572] DEBUG -- : Requesting CAS response for URI http://auth.mytestapp.com/proxyValidate?service=http%3A%2F%2Frails.mytestapp.com%2Fusers%2Fservice&ticket=ST-14872563871889-u80GnDc3lgfz50jSy7Jx3NBcKxvOqn5PFkTop0XK
I, [2017-02-16T17:46:22.254612 #26220]  INFO -- : Completed 500 Internal Server Error in 60004ms (ActiveRecord: 0.0ms)
F, [2017-02-16T17:46:22.259699 #26220] FATAL -- :
Net::OpenTimeout (execution expired):
  /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/net/http.rb:880:in `initialize'
  /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/net/http.rb:880:in `open'

Casino config:

production:
  frontend:
    sso_name: 'CASino'
    footer_text: 'Powered by <a href="http://rbcas.com/">CASino</a>'
  authenticators:
    testapp:
      authenticator: "ActiveRecord"
      options:
        connection:
          host: localhost
          adapter: postgresql
          database: testapp_production
          encoding: unicode
          pool: 5
          username: user
          password: 
        table: "users"
        username_column: "email"
        password_column: "encrypted_password"
        extra_attributes:
          email: "email"
          fullname: "email"

CasController:

class AuthCasController < Devise::CasSessionsController
  # skip_before_action :redirect_to_sign_in, :only => [:new, :single_sign_out]
  skip_before_filter :redirect_to_sign_in,
  only: [:new, :destroy, :single_sign_out, :service, :unregistered]

  # Skip verify_signed_out_user for Devise >= 3.3.0
  skip_before_filter :verify_signed_out_user
end

Devise config:

  config.cas_base_url = 'http://auth.mytestapp.com'
  config.cas_logout_url_param = "destination"
  config.cas_destination_logout_param_name = "service"
  config.cas_create_user = false
  config.cas_enable_single_sign_out = true
  config.cas_username_column = :email

Is there a way to find a problem? I use Ruby 2.3+, but I think it isn't that different

vizakenjack commented 7 years ago

Ok, I solved this. I had to edit /etc/hosts and add server's IP and address auth.mytestapp.com