Thin, Sinatra, and intercepting static file request to do CAS authentication
Posted
by Kenny Peng
on Stack Overflow
See other posts from Stack Overflow
or by Kenny Peng
Published on 2010-04-23T16:02:27Z
Indexed on
2010/04/23
18:43 UTC
Read the original article
Hit count: 460
I'm using the casrack-the-authenticator gem for CAS authentication. My server is running Thin on top of Sinatra. I've gotten the CAS authentication bit working, but I'm not sure how to tell Rack to intercept "/index.html" requests to confirm the CAS login, and if the user is not allowed to view the page, return a HTTP 403 response instead of serving the actual page. Does anyone have experience with this? Thanks.
My app:
class Foo < Sinatra::Base
enable :sessions
set :public, "public"
use CasrackTheAuthenticator::Simple, :cas_server => "https://my.cas_server.com"
use CasrackTheAuthenticator::RequireCAS
end
My rackup file:
require 'foo'
use Rack::CommonLogger
use Rack::Lint
run Foo
© Stack Overflow or respective owner