草庐IT

mutual-authentication

全部标签

ruby - Rails - 未定义的方法 `authenticate'

我在尝试对用户进行身份验证时收到以下错误。NoMethodError(undefinedmethod验证'#)`当我从Rails控制台执行命令时,user.authenticate('password')成功(即返回用户对象)。irb(main):008:0>user.authenticate("sanket")=>#但是,当我将user.authenticate放入辅助类中并使用url访问它时,它会显示undefinedmethod'authenticate'for#我正在关注RailsTutorial我的用户模型是这样的:classUsersession_helper.rb中的相关

ruby-on-rails - rails3,过滤器链停止为 :require_no_authentication rendered or redirected

我的设计有问题。当用户已经登录,然后点击登录链接时,没有任何反应,但我的终端输出如下:Filterchainhaltedas:require_no_authenticationrenderedorredirected这发生在我要ProcessingbySessionsController#newasHTML有什么办法,如果有登录用户,我如何告诉设计转到after_sign_in_path?这是我的登录后路径defafter_sign_in_path_for(resource)ifsession[:user_return_to]return_to=session[:user_return

ruby-on-rails - Rails - 在 Devise 中禁用 "already_authenticated"重定向

我需要我的Rails应用程序只允许具有:admin的用户能够访问sign_up页面并添加用户。但是,如果有人登录(管理员或其他),Devise会重定向他们并显示绑定(bind)到already_authenticated错误的“已登录”消息。我知道还有其他更强大的方法可以解决这个问题,比如创建一个新的Controller来覆盖Devise中的标准Controller,但是因为我对Rails还很陌生,而且我目前的需求很小,所以我只是想禁用那个“already_authenticated”完全重定向。然后,我可以轻松地在sign_up页面的顶部添加一个“if”语句,以防止普通用户访问它,但

ruby - 帮助 Soap Response using ssl basic authentication and client certificates

大家好,我正在尝试使用ssl、客户端证书和基本身份验证向protectedwsdl和web服务发出一个简单的请求。这是代码require'savon'client=Savon::Client.new"https://example.com/service?wsdl"client.request.http.ssl_client_auth(:cert=>OpenSSL::X509::Certificate.new(File.read("cert.pem")),:key=>OpenSSL::PKey::RSA.new(File.read("key.pem")),:verify_mode=>O

ruby-on-rails - API/JSON : Can't verify CSRF token authenticity

我正在尝试为我的Rails应用程序构建一个JSONAPI,并编写了以下方法:defcreateorganization=Organization.find(params[:organization][:node_id])node=organization.nodes.build(nodes_params.except[:id])ifnode.saverenderjson:node,status::okelserenderjson:node,status::bad_requestendend尝试Postman中的方法返回错误:“无法验证CSRFtoken真实性”。基于thispost我将

ruby-on-rails - 在 RSpec 测试中跳过 Rails http_basic_authenticate_with

我正在研究MVP(最小可行产品)。为了提供一种更简单的方法来保护管理页面,我只是将http_basic_authenticate_with添加到我的AdminController。问题是当我想测试我的AdminController时,我得到“未授权”(401),因为我没有登录。在这种情况下,测试身份验证是无关紧要的——它只是暂时的,一旦我进入下一个冲刺,它就会被删除——所以我试图在RSpec中跳过它。问题是我尝试了很多方法,但似乎都没有用。例如,我试图修改http_basic_authenticate_with以避免身份验证。像这样:require'spec_helper'module

ruby-on-rails - rails : FATAL: Password Authentication Failed For User

我在连接Postgres数据库时遇到问题。我为它创建了一个用户(它从未提示我输入密码),所以我运行命令ALTERUSERuser_nameWITHPASSWORDpassword来创建一个。我在Rails项目的配置目录下的database.yml文件中设置了用户名和密码。它仍然告诉我身份验证失败(如我的头衔),我不知道为什么。我根据这个link的答案修改了我的pg_hba.conf文件.我能想到的唯一可以解决这个问题的方法就是让我的用户成为super用户。但是我想知道为什么现在不让它成为super用户就不能工作。有人知道吗?编辑:=>BootingThin=>Rails3.2.11ap

ruby-on-rails - "Not found. Authentication passthru."错误。设计 Omniauthable 模块不会在另一个引擎中使用 't work when it' s

我尝试按照本指南将Devise放入另一个可安装的gem中:HowTo:Usedeviseinsideamountableengine.除了omniauth部分外,一切似乎都运行良好。我正在尝试获取omniauth-google-oauth2上类。我发现it'saknownissueinDevise,但除了建议的解决方案均无效之外,我注意到该问题中提到的解决方案hasalreadybeenimplementedinsideDevise.这是我到目前为止所做的:my_engine/my_engine.gemspecs.add_dependency'omniauth's.add_depend

ruby - Rails 3 Authlogic - 'acts_as_authentic' 未定义

我收到以下错误:NameError(undefinedlocalvariableormethod`acts_as_authentic'for#):app/models/user.rb:2app/controllers/user_controller.rb:3:in`new'我正在使用Rails3.0.0和Ruby1.8.7。Authlogic在我的Gemfile中如下:gem'authlogic',:git=>"git://github.com/binarylogic/authlogic.git"我的User.rb文件的全部内容如下:classUser无论是通过“railsconsol

ruby-on-rails - ruby on rails 中的未定义方法 ‘authenticate'?

我是RubyonRails应用程序的新手,我已经创建了CRUD,但仍然堆积在Login和Logout功能中。这是我的Sessions_controller:defnewenddefcreateuser=User.find_by(email:params[:session][:email].downcase)ifuser&&user.authenticate(params[:session][:passkey])#Logtheuserinandredirecttotheuser'sshowpage.else#Createanerrormessage.flash[:danger]='Inv