Module: Picnic::Authentication::Cas::Session

Defined in:
lib/picnic/authentication.rb

Overview

There must be a smarter way to do this… but for now, we just re-implement the Camping::Session method here to provide session support for CAS.

Instance Method Summary collapse

Instance Method Details

#service(*a) ⇒ Object

This doesn’t work :( MySQL connection is not carried over. define_method(:service, Camping::Session.instance_method(:service))



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/picnic/authentication.rb', line 172

def service(*a)
  Camping::Models::Session.create_schema
  
  session = Camping::Models::Session.persist @cookies
  app = self.class.name.gsub(/^(\w+)::.+$/, '\1')
  @state = (session[app] ||= Camping::H[])
  hash_before = Marshal.dump(@state).hash
  s = super(*a)
  if session
    hash_after = Marshal.dump(@state).hash
    unless hash_before == hash_after
      session[app] = @state
      session.save
    end
  end
  s
end