dlindahl / omniauth-cas

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

Gitlab's logout does not redirect to CAS logout #48

Open tkaito opened 7 years ago

tkaito commented 7 years ago

Hi, I'm trying to use omniauth-cas3-1.1.3 with gitlab-8.14.4. I successfully logged in to gitlab via CAS, but when I logged out, gitlab des not redirect to CAS logout.

gitlab_rails['omniauth_providers'] = [
  {
    "name"=> "cas3",
    "label"=> "cas",
    "args"=> {
      "url"=> 'http://127.0.0.1:8000',
      "login_url"=> '/cas/login',
      "service_validate_url"=> '/cas/p3/serviceValidate',
      "logout_url"=> '/cas/logout',
    }
  }
]

Or should I use "on_single_sign_out"? But I don't know how to use it.

Started DELETE "/users/sign_out" for 192.168.135.150 at 2016-12-14 00:33:12 -0800
Processing by SessionsController#destroy as HTML
  Parameters: {"authenticity_token"=>"**********"}
Redirected to http://192.168.135.150/users/sign_in
Completed 302 Found in 51ms (ActiveRecord: 7.0ms)
Started GET "/users/sign_in" for 192.168.135.150 at 2016-12-14 00:33:12 -0800
Processing by SessionsController#new as HTML
Redirected to http://192.168.135.150/users/auth/cas3
Filter chain halted as :auto_sign_in_with_provider rendered or redirected
Completed 302 Found in 37ms (ActiveRecord: 3.9ms)
Started GET "/users/auth/cas3" for 192.168.135.150 at 2016-12-14 00:33:12 -0800
Processing by OmniAuth::RequestForgeryProtection::Controller#index as HTML
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
Started GET "/users/auth/cas3/callback?ticket=**********&url=http%3A%2F%2F192.168.135.150%2F" for 192.168.135.150 at 2016-12-14 00:33:12 -0800
Processing by OmniauthCallbacksController#cas3 as HTML
  Parameters: {"ticket"=>"**********", "url"=>"http://192.168.135.150/"}
Redirected to http://192.168.135.150/
Completed 302 Found in 147ms (ActiveRecord: 21.9ms)
Started GET "/" for 192.168.135.150 at 2016-12-14 00:33:12 -0800

Thanks,

athariel commented 7 years ago

Same problem here

liaoguode commented 3 years ago

maybe you can change the source code at app/controllers/application_controller.rb, add the logout url to be the function after_sign_out_path_for.

def after_sign_out_path_for(resource) 'http://127.0.0.1:8000/cas/logout' end