Class: Devise::CasSessionsController

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/devise/cas_sessions_controller.rb', line 16

def destroy
  # Delete the ticket->session ID mapping if one exists for this session
  if ticket = session['cas_last_valid_ticket']
    ::DeviseCasAuthenticatable::SingleSignOut::Strategies.current_strategy.delete_session_index(ticket)
  end

  # 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(::Devise.cas_client.logout_url)
end

#newObject



3
4
5
# File 'app/controllers/devise/cas_sessions_controller.rb', line 3

def new
  redirect_to() unless returning_from_cas?
end

#serviceObject



7
8
9
10
11
# File 'app/controllers/devise/cas_sessions_controller.rb', line 7

def service
  warden.authenticate!(:scope => resource_name)
  return redirect_to params[:redirect] if params[:redirect]
  return redirect_to (resource_name)
end

#single_sign_outObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/devise/cas_sessions_controller.rb', line 32

def single_sign_out
  if ::Devise.cas_enable_single_sign_out
    session_index = read_session_index
    if session_index
      logger.info "Intercepted single-sign-out request for CAS session #{session_index}."
      session_id = ::DeviseCasAuthenticatable::SingleSignOut::Strategies.current_strategy.find_session_id_by_index(session_index)
      destroy_cas_session(session_id, session_index) if session_id
    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

  render :nothing => true
end

#unregisteredObject



13
14
# File 'app/controllers/devise/cas_sessions_controller.rb', line 13

def unregistered
end