Web app to serve static content but inject auth based on route?

21 views
Skip to first unread message

J. Lewis Muir

unread,
Jul 25, 2024, 2:03:02 PM7/25/24
to ruby...@googlegroups.com
Hello!

Is there a good reusable Roda-based web app that serves static content
but injects a required authentication page based on the route? I
envision it reading the authentication rules from a configuration file.

If no such web app exists, am I right in thinking that it wouldn't be
too hard to write such an app using Roda and Rodauth?

My use case is that I'd like to use Jekyll to generate a static site,
but I want some parts of the site to require authentication to access.
I don't want to use HTTP Basic Auth, which I could configure in a web
server based on the URL path, because password managers don't support
that. So, I wish for an app that simply serves static content, but
injects an authentication page when authentication is required based
on the URL path. The user could authenticate using a password manager
because password managers *do* support web pages.

Thanks!

Lewis

Jeremy Evans

unread,
Jul 25, 2024, 2:09:34 PM7/25/24
to ruby...@googlegroups.com
I'm not aware of an existing app that does that, but you are correct that it shouldn't be too difficult.  You'd probably want to use the multi_public plugin, with something like:

route do |r|
  r.public(:no_auth)
  r.rodauth
  rodauth.require_authentication
  r.public(:need_auth)
end 

Thanks,
Jeremy

Hartmut Bischoff

unread,
Jul 25, 2024, 5:10:49 PM7/25/24
to Roda
Why do you realize your project with roda/jekyll when we got Bridgetown?  

J. Lewis Muir

unread,
Jul 25, 2024, 6:11:08 PM7/25/24
to ruby...@googlegroups.com
On 07/25, Hartmut Bischoff wrote:
> Why do you realize your project with roda/jekyll when we got Bridgetown?

Because I didn't know about Bridgetown? :-) Thanks for mentioning it;
I'll check it out. And if you feel like sharing anything that you like
about it, I'd be interested to hear. If I were to use it instead of
Jekyll, the first question that comes to mind is, does it support Jekyll
themes? I was thinking of using the "Just the Docs" Jekyll theme.

Lewis

Hartmut Bischoff

unread,
Jul 26, 2024, 12:42:56 AM7/26/24
to Roda
Personally, I am fan of Bridgetown.  Jekyll-Themes have to be adapted. Perhaps you ask the community if someone has done the job. Otherwise feel free to contact me, it should not be too hard, to manage the adaption of the theme.
Reply all
Reply to author
Forward
0 new messages