module Picnic::Authentication::Cas::Session

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.

Public Instance Methods

service(*a) click to toggle source
This doesn't work :( MySQL connection is not carried over.

define_method(:service, Camping::Session.instance_method(:service))

Calls superclass method
# 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