草庐IT

www-authenticate

全部标签

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 - 打开 ("http://www.google.com' ) 失败但 wget 工作

打开失败:irb(main):001:0>require'open-uri'=>trueirb(main):002:0>open("http://www.google.com")RuntimeError:Non-HTTPproxyURI:from/usr/lib/ruby/1.8/open-uri.rb:203:in`open_http'from/usr/lib/ruby/1.8/open-uri.rb:616:in`buffer_open'from/usr/lib/ruby/1.8/open-uri.rb:164:in`open_loop'from/usr/lib/ruby/1.8/

ruby - 使用 Ruby WWW::Mechanize 时忽略 Iconv::IllegalSequence

我在使用mechanize库时在某些网页上遇到了Iconv::IllegalSequence错误。有没有办法让Mechanize只是忽略错误编码的字符并返回“剪切”页面?我知道relatedthread,但我宁愿丢弃页面上的一些字符,然后重新实现编码猜测。时间差 最佳答案 解决办法是把util.rb中的第40行改成Iconv.iconv(code,"UTF-8",s).join("")到Iconv.iconv("#{code}//IGNORE","UTF-8",s).join("")或Iconv.conv("#{code}//IGN

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

ruby-on-rails - 设计:用户模型中的 authentication_token 列为空

我刚刚创建了一个安装了设计插件的示例应用程序。我的用户模型中有:token_authenticatable但由于某种原因,当我创建用户时,它使用authentication_token列作为NULL创建它。看起来你需要在创建新用户时设置u.ensure_authentication_token!来生成token。我是否遗漏了什么或者我需要覆盖设计的代码? 最佳答案 在你的用户类中,添加classUser这是一种将设置您的authentication_token的设计方法。 关于ruby-

go - Go : unable to authenticate, 中的 SSH 尝试了方法 [无],没有支持的方法

我尝试使用SSH和Go连接到我的一台虚拟机。如果我这样做,它可以通过命令行完美运行:sshroot@my_host我输入密码,一切正常。我尝试在Go中执行此操作,这是我的代码:packagemainimport("golang.org/x/crypto/ssh""fmt")funcconnectViaSsh(user,hoststring,passwordstring)(*ssh.Client,*ssh.Session){config:=&ssh.ClientConfig{User:user,Auth:[]ssh.AuthMethod{ssh.Password(password)},H