Class: CASServer::Controllers::Logout
- Inherits:
-
R
- Object
- R
- CASServer::Controllers::Logout
- Includes:
- CASServer::CAS
- Defined in:
- lib/casserver/controllers.rb
Overview
2.3
Instance Method Summary collapse
-
#get ⇒ Object
2.3.1.
Methods included from CASServer::CAS
clean_service_url, #generate_login_ticket, #generate_proxy_granting_ticket, #generate_proxy_ticket, #generate_service_ticket, #generate_ticket_granting_ticket, #send_logout_notification_for_service_ticket, #service_uri_with_ticket, #validate_login_ticket, #validate_proxy_granting_ticket, #validate_proxy_ticket, #validate_service_ticket, #validate_ticket_granting_ticket
Instance Method Details
#get ⇒ Object
2.3.1
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/casserver/controllers.rb', line 220 def get CASServer::Utils::log_controller_action(self.class, input) # The behaviour here is somewhat non-standard. Rather than showing just a blank # "logout" page, we take the user back to the login page with a "you have been logged out" # message, allowing for an opportunity to immediately log back in. This makes it # easier for the user to log out and log in as someone else. @service = clean_service_url(input['service'] || input['destination']) @continue_url = input['url'] @gateway = input['gateway'] == 'true' || input['gateway'] == '1' tgt = CASServer::Models::TicketGrantingTicket.find_by_ticket(['tgt']) .delete 'tgt' if tgt CASServer::Models::TicketGrantingTicket.transaction do $LOG.debug("Deleting Service/Proxy Tickets for '#{tgt}' for user '#{tgt.username}'") tgt.granted_service_tickets.each do |st| send_logout_notification_for_service_ticket(st) if $CONF.enable_single_sign_out # TODO: Maybe we should do some special handling if send_logout_notification_for_service_ticket fails? # (the above method returns false if the POST results in a non-200 HTTP response). $LOG.debug "Deleting #{st.class.name.demodulize} #{st.ticket.inspect} for service #{st.service}." st.destroy end pgts = CASServer::Models::ProxyGrantingTicket.find(:all, :conditions => [CASServer::Models::Base.connection.quote_table_name(CASServer::Models::ServiceTicket.table_name)+".username = ?", tgt.username], :include => :service_ticket) pgts.each do |pgt| $LOG.debug("Deleting Proxy-Granting Ticket '#{pgt}' for user '#{pgt.service_ticket.username}'") pgt.destroy end $LOG.debug("Deleting #{tgt.class.name.demodulize} '#{tgt}' for user '#{tgt.username}'") tgt.destroy end $LOG.info("User '#{tgt.username}' logged out.") else $LOG.warn("User tried to log out without a valid ticket-granting ticket.") end @message = {:type => 'confirmation', :message => _("You have successfully logged out.")} @message[:message] +=_(" Please click on the following link to continue:") if @continue_url @lt = generate_login_ticket if @gateway && @service redirect(@service, :status => 303) elsif @continue_url render :logout else render :login end end |