mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 15:50:13 +01:00
This is at least one issue with this
to logout of CAS you need session information but the logout method blows this away so I do the cas log out before the session is killed so the session persistest in rails. Because I needed to move the CAS before filters into login_cas and out of the application to make it work side by side. The user will still be logined into tracks even though their CAS session is closed as the session will still be there.
def logout
@user.forget_me if logged_in?
cookies.delete :auth_token
session['user_id'] = nil
if ( SITE_CONFIG['authentication_schemes'].include? 'cas') && session[:cas_user]
CASClient::Frameworks::Rails::Filter.logout(self)
else
reset_session
notify :notice, "You have been logged out of Tracks."
redirect_to_login
end
end
The other issue I have with this is that:
I could not find a use case for having mixed auth when using CAS. The reason to move to CAS is that all your users use CAS all the time. Even for admin accounts. Moodle is a good example of this in that when you activate CAS the default is that you can now only access moodle via CAS. By allowing mixed auth and self signup you end up with a anyone (the public) being able to sign up for accounts.
78 lines
3.7 KiB
Ruby
78 lines
3.7 KiB
Ruby
ActionController::Routing::Routes.draw do |map|
|
|
map.with_options :controller => 'login' do |login|
|
|
login.login 'login', :action => 'login'
|
|
login.login_cas 'login_cas', :action => 'login_cas'
|
|
login.formatted_login 'login.:format', :action => 'login'
|
|
login.logout 'logout', :action => 'logout'
|
|
login.formatted_logout 'logout.:format', :action => 'logout'
|
|
end
|
|
|
|
map.resources :users,
|
|
:member => {:change_password => :get, :update_password => :post,
|
|
:change_auth_type => :get, :update_auth_type => :post, :complete => :get,
|
|
:refresh_token => :post }
|
|
map.with_options :controller => "users" do |users|
|
|
users.signup 'signup', :action => "new"
|
|
end
|
|
|
|
map.resources :contexts, :collection => {:order => :post} do |contexts|
|
|
contexts.resources :todos, :name_prefix => "context_"
|
|
end
|
|
|
|
map.resources :projects, :collection => {:order => :post, :alphabetize => :post} do |projects|
|
|
projects.resources :todos, :name_prefix => "project_"
|
|
end
|
|
|
|
map.resources :projects, :collection => {:order => :post, :actionize => :post} do |projects|
|
|
projects.resources :todos, :name_prefix => "project_"
|
|
end
|
|
|
|
map.resources :todos,
|
|
:member => {:toggle_check => :put, :toggle_star => :put},
|
|
:collection => {:check_deferred => :post, :filter_to_context => :post, :filter_to_project => :post}
|
|
map.with_options :controller => "todos" do |todos|
|
|
todos.home '', :action => "index"
|
|
todos.tickler 'tickler', :action => "list_deferred"
|
|
todos.mobile_tickler 'tickler.m', :action => "list_deferred", :format => 'm'
|
|
todos.done 'done', :action => "completed"
|
|
todos.done_archive 'done/archive', :action => "completed_archive"
|
|
|
|
# This route works for tags with dots like /todos/tag/version1.5
|
|
# please note that this pattern consumes everything after /todos/tag
|
|
# so /todos/tag/version1.5.xml will result in :name => 'version1.5.xml'
|
|
# UPDATE: added support for mobile view. All tags ending on .m will be
|
|
# routed to mobile view of tags.
|
|
todos.tag 'todos/tag/:name.m', :action => "tag", :format => 'm'
|
|
todos.tag 'todos/tag/:name', :action => "tag", :name => /.*/
|
|
|
|
todos.calendar 'calendar.ics', :action => "calendar", :format => 'ics'
|
|
todos.calendar 'calendar', :action => "calendar"
|
|
|
|
todos.mobile 'mobile', :action => "index", :format => 'm'
|
|
todos.mobile_abbrev 'm', :action => "index", :format => 'm'
|
|
todos.mobile_abbrev_new 'm/new', :action => "new", :format => 'm'
|
|
end
|
|
map.root :controller => 'todos' # Make OpenID happy because it needs #root_url defined
|
|
|
|
map.resources :notes
|
|
map.feeds 'feeds', :controller => 'feedlist', :action => 'index'
|
|
map.feeds 'feeds.m', :controller => 'feedlist', :action => 'index', :format => 'm'
|
|
|
|
if Rails.env == 'test'
|
|
map.connect '/selenium_helper/login', :controller => 'selenium_helper', :action => 'login'
|
|
end
|
|
|
|
map.preferences 'preferences', :controller => 'preferences', :action => 'index'
|
|
map.integrations 'integrations', :controller => 'integrations', :action => 'index'
|
|
map.search_plugin '/integrations/search_plugin.xml', :controller => 'integrations', :action => 'search_plugin', :format => 'xml'
|
|
map.google_gadget '/integrations/google_gadget.xml', :controller => 'integrations', :action => 'google_gadget', :format => 'xml'
|
|
map.stats 'stats', :controller => 'stats', :action => 'index'
|
|
|
|
map.resources :recurring_todos,
|
|
:member => {:toggle_check => :put, :toggle_star => :put}
|
|
map.recurring_todos 'recurring_todos', :controller => 'recurring_todos', :action => 'index'
|
|
|
|
# Install the default route as the lowest priority.
|
|
map.connect ':controller/:action/:id'
|
|
|
|
end
|