Class: Devise::CasSessionsController

Inherits:
SessionsController
  • Object
show all
Includes:
DeviseCasAuthenticatable::SingleSignOut::DestroySession
Defined in:
app/controllers/devise/cas_sessions_controller.rb

Instance Method Summary collapse

Methods included from DeviseCasAuthenticatable::SingleSignOut::DestroySession

#current_session_store, #destroy_session_by_id, #session_store_class, #session_store_identifier

Methods included from DeviseCasAuthenticatable::SingleSignOut::WithConn

#with_conn

Instance Method Details

#destroyObject


26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/devise/cas_sessions_controller.rb', line 26

def destroy
  # if :cas_create_user is false a CAS session might be open but not signed_in
  # in such case we destroy the session here
  if signed_in?(resource_name)
    sign_out(resource_name)
  else
    reset_session
  end

  redirect_to(cas_logout_url)
end

#newObject


11
12
13
14
15
16
17
# File 'app/controllers/devise/cas_sessions_controller.rb', line 11

def new
  if memcache_checker.session_store_memcache? && !memcache_checker.alive?
    raise "memcache is down, can't get session data from it"
  end

  redirect_to()
end

#serviceObject


19
20
21
# File 'app/controllers/devise/cas_sessions_controller.rb', line 19

def service
  redirect_to (warden.authenticate!(:scope => resource_name))
end

#single_sign_outObject


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/devise/cas_sessions_controller.rb', line 38

def single_sign_out
  if ::Devise.cas_enable_single_sign_out
    session_index = read_session_index
    if session_index
      logger.debug "Intercepted single-sign-out request for CAS session #{session_index}."
      session_id = ::DeviseCasAuthenticatable::SingleSignOut::Strategies.current_strategy.find_session_id_by_index(session_index)
      if session_id
        logger.debug "Found Session ID #{session_id} with index key #{session_index}"
        destroy_cas_session(session_index, session_id)
      end
    else
      logger.warn "Ignoring CAS single-sign-out request as no session index could be parsed from the parameters."
    end
  else
    logger.warn "Ignoring CAS single-sign-out request as feature is not currently enabled."
  end

  head :ok
end

#unregisteredObject


23
24
# File 'app/controllers/devise/cas_sessions_controller.rb', line 23

def unregistered
end