Add authentication to Middleman

Hey there,

We are using Middleman at work for documentation and the topic of how to protect sensitive data was raised.

First question: is there a way to add Google Auth? We are already using it for other company-related-apps and that would be very convenient.

Second question: if not G Auth, any other alternatives?

Thanks in advance! :smile:
Oana

Since Middleman generates static HTML site, what exactly you expect it to authenticate? You can use simple HTTP-auth solution for static HTML content, or whatever your web-server is providing.

Thanks @komor72, indeed, that worked. I am checking what Rack offers too. If I get somewhere with it, will post it here.

But still, Rack is a middleware-piece, that does not exist when the site is compiled to static HTML files. Rack (and other Ruby/Rails niceties) are only used in developer mode, when Middleman dynamically creates pages on-the-fly. It is possible to use Middleman in developer-server mode on production server (Heroku, others), but it doesnโ€™t make much sense. If you need any dynamic features then it is better to use Sinatra, Rails or anything other that works as a dynamic web-app.

I love Middleman and I mix it with some PHP code in one of the projects (long story), but using it as Ruby-based dynamic web-app is a little bit odd. Where Middleman shines is when you need to update the static content from time to time, or generate/update static content from some text/database/xml/whaterver source using the /data/ folder to generate pages. Blog extension is very useful and allows to custom-program many features โ€“ and then compile it to static site. You can plug the dynamic comment system (based on Disqus) or dynamic search feature, but primarily you have a static set of generated HTML files.

Thanks a lot @komor72 for clarifying this, it was of great help! (sorry for my late reply!)