使用 Authentication from scratch system 是个好主意吗?来自生产应用程序中 Hart 的 Ruby on Rail 教程?使用它有安全问题吗?已经在使用它的应用是否应该迁移到 Devise?如何做到这一点?
最佳答案
在我看来,使用像 devise
这样的 gem 是比从头编写身份验证更好的解决方案,因为您甚至可能不知道此类 gem 可以为我们处理的一些安全问题,因为它们由整个社区而不是一个人开发。
此外,当我已经有了一个很棒的解决方案时,我真的不想重新发明轮子。我在许多生产应用程序中使用过 devise
,它比普通身份验证做得更多,这就是它的闪光点:)
但是,如果您正在通过 ruby on rails 学习自己的方法,我真的建议您从头开始编写身份验证,但即便如此,最初也不要用于生产应用程序。
正如 devise's documentation 中所说:
If you are building your first Rails application, we recommend you to not use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch, today we have two resources:
Michael Hartl's online book: http://railstutorial.org/chapters/modeling-and-viewing-users-two#top Ryan Bates' Railscast: http://railscasts.com/episodes/250-authentication-from-scratch
Once you have solidified your understanding of Rails and authentication mechanisms, we assure you Devise will be very pleasant to work with. :)
关于ruby-on-rails - 在生产应用程序中从头开始进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20695495/