2011-08-12 73 views
1

我正在處理一個應用程序,我想通過我在另一臺服務器上設置的自定義oauth提供程序進行身份驗證。RefineryCMS:覆蓋設計Omniauth回調

我正在嘗試使用RefineryCMS集成此自定義登錄。我有我的路線設置,但由於某種原因,它仍然試圖遵循RefineryCMS內置的設計路線。

的routes.rb

devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } 
devise_scope :users do 
match '/users/auth/:provider', :to => 'users/omniauth_callbacks#passthru' 
end 

鏈接,回調

<p><%= link_to "Sign in with Olympus", user_omniauth_callback_path(:olympus) %></p> 

奧林巴斯是該項目目前的代號。

Omniauth回調控制器:

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController 
    def olympus 
    auth = env["omniauth.auth"] 
    ap auth 
    end 

    def passthru 
    render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false 
    end 
end 

日誌通過軌道一度鏈接被點擊:

Started GET "https://stackoverflow.com/users/auth/olympus/callback" for 127.0.0.1 at 2011-08-12 07:52:09 -0500 
    Processing by Devise::OmniauthCallbacksController#failure as 
    SQL (0.7ms) SHOW TABLES 
    SQL (0.6ms) SHOW TABLES 
    Page Load (0.3ms) SELECT `pages`.`id`, `pages`.`depth`, `pages`.`parent_id`, `pages`.`lft`, `pages`.`rgt`, `pages`.`link_url`, `pages`.`menu_match`, page_translations.title as page_title FROM `pages` INNER JOIN `page_translations` ON `page_translations`.`page_id` = `pages`.`id` WHERE `pages`.`draft` = 0 AND `pages`.`show_in_menu` = 1 AND `page_translations`.`locale` = 'en' ORDER BY lft ASC 
    Slug Load (0.1ms) SELECT `slugs`.* FROM `slugs` WHERE (`slugs`.`sluggable_id` IN (1,3) and `slugs`.`sluggable_type` = 'Page' AND (`slugs`.`locale` = 'en')) ORDER BY id DESC 
    Slug Load (0.2ms) SELECT `slugs`.* FROM `slugs` WHERE (`slugs`.sluggable_id = 3 AND `slugs`.sluggable_type = 'Page') ORDER BY id DESC 
    SQL (1.3ms) describe `roles_users` 
    Role Load (0.1ms) SELECT `roles`.* FROM `roles` WHERE `roles`.`title` = 'Refinery' LIMIT 1 
    SQL (1.4ms) describe `roles_users` 
    User Load (0.2ms) SELECT * FROM `users` INNER JOIN `roles_users` ON `users`.id = `roles_users`.user_id WHERE (`roles_users`.role_id = 1) 
Redirected to http://localhost:3000/users/login 

因此,它仍在試圖通過RefineryCMS要經過設計:: OmniauthCallbacksController ..有誰知道如何解決這個問題,或者甚至可以重寫這個設計控制器?

我也想說,我是與oauth提供商/客戶合作的全新手段。我曾與Facebook和Twitter合作過,但從頭開始是我的新事物。以及與Devise/Omniauth合作。所以請原諒我的無知。謝謝!通過閱讀這篇文章

回答