What is a very simple authentication scheme for Sinatra/Rack
问题 I am busy porting a very small web app from ASP.NET MVC 2 to Ruby/Sinatra. In the MVC app, FormsAuthentication.SetAuthCookie was being used to set a persistent cookie when the users login was validated correctly against the database. I was wondering what the equivalent of Forms Authentication would be in Sinatra? All the authentication frameworks seem very bulky and not really what I'm looking for. 回答1: Here is a very simple authentication scheme for Sinatra. I’ll explain how it works below.