This is done correctly when you try to reload a page with the same ticket. This ticket has already been confirmed. When you receive a verification response, you need to set your own application cookie or other session option.
I usually add a method that will add a session attribute to the user's cookie, for example:
session["cas"]["username"] = <user from cas validation response>
Then, in future queries, the Sinatra application can protect any routes you want with a helper method, for example:
cas = RestClient::Resource.new "#{cas_url}/login", :timeout => 5 checked = cas.get return true if checked.code == 200
In my configuration block for Sinatra, I do this:
use Rack::Session::Cookie, :key => "example.com",:secret => "veryrandomhex"
Hope this helps if you have any questions let me know.
UPDATE BELOW
When discussing this issue, we found that RubyCas says that it does not use a regular cookie session for your ruby application during production when using CAS. What you want to do is:
a. Make sure your cookie expires at the same time or earlier than the CAS cookie
and / or
C. Verify that your cookie is in a browser session, and then re-validate the CAS user in the next browser session.
For a Rack cookie, you must specify this additional configuration when the cookie expires :expire_after => 1440, (where 1440 in minutes)