ruby-on-rails – 当我尝试使用Omniauth Google Apps时,为什么he
发布时间:2020-12-17 03:00:59 所属栏目:百科 来源:网络整理
导读:我正在尝试使用Omniauth为Google Apps提供简单的基本身份验证.一切都在本地工作正常(即使在生产模式下),但在Heroku上我得到以下内容: app[web.1]: Started GET "/auth/admin" for 24.155.228.161 at Fri Jul 22 15:10:26 -0700 2011heroku[router]: Error H
我正在尝试使用Omniauth为Google Apps提供简单的基本身份验证.一切都在本地工作正常(即使在生产模式下),但在Heroku上我得到以下内容:
app[web.1]: Started GET "/auth/admin" for 24.155.228.161 at Fri Jul 22 15:10:26 -0700 2011 heroku[router]: Error H12 (Request timeout) -> GET example.com/auth/admin dyno=web.1 queue= wait= service=30000ms status=503 bytes= heroku[router]: Error H12 (Request timeout) -> GET example.com/ dyno=web.1 queue= wait= service=30000ms status=503 bytes=0 app[web.1]: Generated checkid_setup request to https://www.google.com/a/example.com/o8/ud?be=o8 with assocication AOQobUegRUNfEpz1JOO2bZe0zXrjkdIvdsjpVyCh3rtbL_s-GSfhQ_zY 我的设置如下; # initializers/omniauth.rb require "openid/fetchers" OpenID.fetcher.ca_file = "#{Rails.root}/cacert.crt" require 'openid/store/filesystem' Rails.application.config.middleware.use OmniAuth::Builder do provider :google_apps,OpenID::Store::Filesystem.new('./tmp') use OmniAuth::Strategies::GoogleApps,OpenID::Store::Filesystem.new('./tmp'),:name => 'admin',:domain => 'bcarc.com' #,:client_options => {:ssl => {:ca_file => './cacert.crt'}} end 我已经尝试过切换到memcached,但我无法让memcached-northscale或dalli工作,无论如何我已经验证了nonce正在正确保存在./tmp中,所以我不认为这是问题. 我收到有关CA证书的错误,但是指定了对fetcher的证书文件解决了这个问题,而且我仍然得到了超时. 有什么建议? 更新: 解决方法
好吧,所以经过多次拉毛后,看起来这是OmniAuth手绘Google Apps URI的问题.我最终使用普通的google OpenID端点,然后手动验证控制器中的域.对于任何有兴趣的人,我的代码现在看起来像这样:
require "openid/fetchers" OpenID.fetcher.ca_file = "#{Rails.root}/cacert.crt" require 'openid/store/filesystem' Rails.application.config.middleware.use OmniAuth::Builder do provider :openid,OpenID::Store::Filesystem.new('./tmp') use OmniAuth::Strategies::OpenID,:name => 'openid',:identifier => 'https://www.google.com/accounts/o8/id' end 前两行消除了Heroku抛出的一些SSL警告.我正在使用./tmp进行文件存储,而且工作得很好.在我的控制器中,我有一个if / then子句,用于在经过身份验证的电子邮件中检查我的域,并重定向到一个页面,告诉用户选择正确的帐户. 这不是一个想法的解决方案,但我无法使用特定于应用程序的OpenID标识符来完成任何工作. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |