jjzjj

authenticate

全部标签

ruby-on-rails - 为自定义 omniauth 策略获取 "Authentication failure! invalid_credentials: OAuth2::Error"

目前我正在处理Rails4项目,现在我必须链接/连接另一个应用程序(不是sso,而是用于访问API),比如example.com。(注意example.com使用三足式oauth安全架构)搜索后发现必须要实现omniouth策略。为此我引用了this关联。根据Strategy-Contribution-Guide我能够完成设置和请求阶段,您可以在此处找到我的示例代码。require'multi_json'require'omniauth/strategies/oauth2'require'uri'moduleOmniAuthmoduleStrategiesclassMyAppStrat

git push报错:fatal: Authentication failed for ‘https://github.com/...

第一次用git传代码到GitHub时,填写用户名和密码出现报错:fatal:Authenticationfailedfor'https://github.com/试了下面的没用😢gitconfig-–globaluser.name"xxx"gitconfig--globaluser.email"xxx@xx.com"查看报错原因发现是因为git更新了认证方式在错误提示(糟糕忘截图)的网站里有说明-->https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-

ruby - 我想覆盖设计 gem 的 authenticate_user 和 current_user 方法

我想覆盖authenticate_user!和我的应用程序Controller中设计gem的current_user方法你能帮我解决这个问题吗谢谢 最佳答案 你可以像猴子一样修补它:moduleDevisemoduleControllersmoduleHelpersdefauthenticate_user!#dosomestuffendendendend但我会问最终目标是什么,因为Devise已经内置了一些可定制性,覆盖这些方法让我想知道“为什么要使用Devise?” 关于ruby-我想

ruby-on-rails - Capistrano 无法部署代码,因为 Net::SSH::AuthenticationFailed: Authentication failed

我们有一个在AmazonAWS上运行的Rails应用程序。连续几个月,我们几乎每天都向那里推送新代码。今天,当我试图在那里部署一个新代码时,我得到了这个错误信息:*2014-02-1613:09:51executing`deploy'*2014-02-1613:09:51executing`deploy:update'**transaction:start*2014-02-1613:09:51executing`deploy:update_code'updatingthecachedcheckoutonallserversexecutinglocally:"gitls-remotegi

ruby-on-rails - 在 rails 上使用 htaccess 密码保护?

我希望使用.htaccess密码文件保护我的Rails应用程序上的/admin路由-这可能吗? 最佳答案 Rails有一个内置的助手,你可以把它放在你的应用程序Controller中:protecteddefauthenticateauthenticate_or_request_with_http_basicdo|username,password|username=="admin"&&password=="test"endend然后在您想要保护的任何Controller上使用before_filter(或者只是将其粘贴在应用程序C

ruby-on-rails - Rails 3 with Devise for Authentication - 如何手动创建用户?

我想手动创建新的用户,而不是强制他们验证他们的电子邮件地址。这个想法是让现有用户无需注册即可自动添加他们的friend。这对我正在努力解决的业务案例很有意义。如何使用Devise实现这一目标? 最佳答案 skip_confirmation!方法可用于任何confirmable模型。@user=User.newparams[:user]@user.skip_confirmation!#Setsconfirmed_attoTime.now,activatingtheaccount@user.save不过,用户帐户将被激活。如果您不想这样

ruby-on-rails - 如何使用 Rails 3 获取请求的目标 Controller 和操作?

在过滤器之前的应用程序Controller中。classApplicationController 最佳答案 classApplicationController 关于ruby-on-rails-如何使用Rails3获取请求的目标Controller和操作?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/5418454/

ruby - 警告 : Can't verify CSRF token authenticity in case of API development

我现在正在使用RubyonRails开发网络API。当Rails应用程序收到没有任何csrftoken的POST请求时,将出现以下错误消息。因为该应用没有View。WARNING:Can'tverifyCSRFtokenauthenticity所以我的问题是在这种情况下如何安全地逃避csrftoken检查?非常感谢您。 最佳答案 你可以通过添加skip_before_filter:verify_authenticity_token到你的Controller。这样,所有传入Controller的请求都会跳过:verify_authen

ruby-on-rails - 所有 Ruby 测试都引发 : undefined method `authenticate' for nil:NilClass

我的大部分测试都引发了以下问题,我不明白为什么。所有方法调用都会引发“验证”错误。我检查了代码是否有一个名为“authenticate”的方法,但没有这样的方法。1)Admin::CommentsControllerhandlingGETtoindexissuccessfulFailure/Error:get:indexundefinedmethod`authenticate!'fornil:NilClass#./spec/controllers/admin/comments_controller_spec.rb:9:in`block(3levels)in'124)PostsContr

javascript - PassportJS - 动态设置状态以允许在回调时重定向

所以我正在处理提供的信息here添加Google将重定向到用户在重定向到google之前所在页面的功能。我目前使用的是最新版本的Express、PassportJS和Googleoauth2。例如,如果用户点击页面http://example.com/privatecontent,它会自动重定向到要求登录的Google,并在成功后返回到我的Node应用程序,除了它不知道最后一页是/privatecontent而是重定向到索引。如果我理解正确,我可以使用state参数让Google知道将state参数发回,这样我就可以读取它并重定向自己。我基本上希望我的函数看起来像这样,但我无权访问re