Hi,
I successfully setup rubycas server along with some cassified application (I'm using last rubycas server e client gems with ruby 1.9.3 and rails 3). One app is using gatewayfilter to filter requests, everything works fine except for json format. After some debugging I come across to this code in filter.rb:
def unauthorized!(controller, vr = nil)
format = nil
unless controller.request.format.nil?
format = controller.request.format.to_sym
end
format = (format == :js ? :json : format)
case format
when :xml, :json
if vr
case format
when :xml
controller.send(:render, :xml => { :error => vr.failure_message }.to_xml(:root => 'errors'), :status => :unauthorized)
when :json
controller.send(:render, :json => { :errors => { :error => vr.failure_message }}, :status => :unauthorized)
end
else
controller.send(:head, :unauthorized)
end
else
redirect_to_cas_for_authentication(controller)
end
end
I don't understand why json and xml are special. Probably I'm doing something wrong ...
Thanks,
Stefano