gpt4 book ai didi

ruby-on-rails - Rails http_basic_authenticate_with

转载 作者:行者123 更新时间:2023-12-04 03:54:13 27 4
gpt4 key购买 nike

刚刚有一个关于 http_basic_authenticate_with 的新手问题。如果我在我的 Controller 中放置一些简单的东西,

http_basic_authenticate_with :name => "user", :password => "secret"

如何确保密码安全。我只想能够将应用程序投入生产/发布,并以安全的方式保护整个应用程序的密码。

感谢您的任何建议。

最佳答案

我可以建议将密码放在环境中。例如你可以做 http://www.cyberciti.biz/faq/set-environment-variable-linux/export APP_USER='secret_user'export APP_PASSWORD='secret_password'

# then in controller
http_basic_authenticate_with :name => ENV['secret_user'], :password => ENV['secret_password']

关于ruby-on-rails - Rails http_basic_authenticate_with,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19804875/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com