如何开发可用于多个项目的身份验证/授权插件

时间:2023-01-16 15:06:09

I am a newbie for RoR but I liked it so far. For the current project I already developed an authenticaion page where the user will be authenticated before and after login. I know that I will be doing more projects on RoR in the coming weeks as well and I don't want to copy paste my codes to enable authentication in my projects. How can I create an authentication system where I can use it in multiple projects. Are there any plugins already been developed?

我是RoR的新手但到目前为止我很喜欢它。对于当前项目,我已经开发了一个认证页面,用户将在登录前后进行身份验证。我知道我将在未来几周内在RoR上做更多的项目,我不想复制粘贴我的代码以在我的项目中启用身份验证。如何创建一个身份验证系统,我可以在多个项目中使用它。是否已经开发了任何插件?

You should also consider that, the authentication system also be on call (it should be listening everytime the user goes from one page to another page by checking if s/he is authorized and also the session haven't expired yet and so on.). That means I still need the authentication/authorization system to be there even after login. And how do I integrate it with other ruby projects I will be working on. I hope it makes sense.

您还应该考虑到,身份验证系统也处于通话状态(每次用户从一个页面转到另一个页面时,应通过检查他/她是否已获得授权以及会话尚未过期等来监听。) 。这意味着即使在登录后我仍然需要认证/授权系统。我如何将其与我将要开展的其他ruby项目集成。我希望这是有道理的。

The database where users will be authorized might be the same or different based on the projects.

根据项目,授权用户的数据库可能相同或不同。

Thank you

谢谢

1 个解决方案

#1


3  

Authentication/Authorization can be a tricky task. There are many pitfalls, so it would better to use a well tested gem until you're more familiar with it. Devise is a good option, but you can start learning about rolling your own authentication in the Rails Tutorial book if you're inclined.

身份验证/授权可能是一项棘手的任务。有许多陷阱,所以最好使用经过良好测试的宝石,直到你对它更熟悉。设计是一个很好的选择,但是如果你愿意的话,你可以开始学习如何在Rails教程书中滚动自己的身份验证。

#1


3  

Authentication/Authorization can be a tricky task. There are many pitfalls, so it would better to use a well tested gem until you're more familiar with it. Devise is a good option, but you can start learning about rolling your own authentication in the Rails Tutorial book if you're inclined.

身份验证/授权可能是一项棘手的任务。有许多陷阱,所以最好使用经过良好测试的宝石,直到你对它更熟悉。设计是一个很好的选择,但是如果你愿意的话,你可以开始学习如何在Rails教程书中滚动自己的身份验证。