Module: Devise::Models::Ticketable

Extended by:
ActiveSupport::Concern
Defined in:
lib/devise_ticketable/model.rb

Overview

This module generates cookie tickets compatible with the “mod_auth_tkt” apache module.

Based on work by: MESO Web Scapes, Sascha Hanssen www.meso.net/auth_tkt_rails | [email protected]

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#destroy_auth_tkt_cookie!Object

destroys the auth_tkt cookie to sign out the current user



15
16
17
18
# File 'lib/devise_ticketable/model.rb', line 15

def destroy_auth_tkt_cookie!
  # reset ticket value of cookie, safeguard if deleting the cookie fails
  {:value => '', :expire => Time.at(0), :domain => self.class.auth_tkt_domain}
end

#get_auth_tkt_cookie!(options, request) ⇒ Object

sets the auth_tkt cookie, returns the signed cookie string



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/devise_ticketable/model.rb', line 21

def get_auth_tkt_cookie!(options, request)
  # get signed cookie string
  tkt_hash = get_tkt_hash(options, request)

  cookie_data = {:value => tkt_hash}

  # set domain for cookie, if wanted
  cookie_data[:domain] = self.class.auth_tkt_domain if self.class.auth_tkt_domain

  # return signed cookie
  cookie_data
end