I also went down this road recently, and discovered caddy-security, but I have security concerns [0]. Software always has vulnerabilities, but this was enough to scare me off. Something like keycloak or authentia seems more tested and secure.
[0] https://blog.trailofbits.com/2023/09/18/security-flaws-in-an...