Sha256: 95889942cffc54755d2961aeb9e59e4cb8d8566d68c5ee8e41af9d80c6e3556f

Contents?: true

Size: 1.81 KB

Versions: 7

Compression:

Stored size: 1.81 KB

Contents

if ActionController::Routing.name =~ /ActionDispatch/
  # Rails 3
  
  ActionDispatch::Routing::Mapper.class_eval do
    protected
  
    def devise_cas_authenticatable(mapping, controllers)
      # service endpoint for CAS server
      get "service", :to => "#{controllers[:cas_sessions]}#service", :as => "service"
      post "service", :to => "#{controllers[:cas_sessions]}#single_sign_out", :as => "single_sign_out"

      resource :session, :only => [], :controller => controllers[:cas_sessions], :path => "" do
        get :new, :path => mapping.path_names[:sign_in], :as => "new"
        get :unregistered
        post :create, :path => mapping.path_names[:sign_in]
        match :destroy, :path => mapping.path_names[:sign_out], :as => "destroy"
      end      
    end
  end
else
  # Rails 2
  
  ActionController::Routing::RouteSet::Mapper.class_eval do
    protected
    
    def cas_authenticatable(routes, mapping)
      routes.with_options(:controller => 'devise/cas_sessions', :name_prefix => nil) do |session|
        session.send(:"#{mapping.name}_service", '/service', :action => 'service', :conditions => {:method => :get})
        session.send(:"#{mapping.name}_service", '/service', :action => 'single_sign_out', :conditions => {:method => :post})
        session.send(:"unregistered_#{mapping.name}_session", '/unregistered', :action => "unregistered", :conditions => {:method => :get})
        session.send(:"new_#{mapping.name}_session", mapping.path_names[:sign_in], :action => 'new', :conditions => {:method => :get})
        session.send(:"#{mapping.name}_session", mapping.path_names[:sign_in], :action => 'create', :conditions => {:method => :post})
        session.send(:"destroy_#{mapping.name}_session", mapping.path_names[:sign_out], :action => 'destroy', :conditions => { :method => :get })
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
devise_cas_authenticatable-1.0.1 lib/devise_cas_authenticatable/routes.rb
devise_cas_authenticatable-1.1.2 lib/devise_cas_authenticatable/routes.rb
devise_cas_authenticatable-1.1.1 lib/devise_cas_authenticatable/routes.rb
devise_cas_authenticatable-1.1.0 lib/devise_cas_authenticatable/routes.rb
devise_cas_authenticatable-1.0.0 lib/devise_cas_authenticatable/routes.rb
devise_cas_authenticatable-1.0.0.alpha13 lib/devise_cas_authenticatable/routes.rb
devise_cas_authenticatable-1.0.0.alpha12 lib/devise_cas_authenticatable/routes.rb