Keycloak with Discourse

Actually, you can get this behavior on both OAuth2 and SSO, by checking the login_required setting.

However, this will prevent anonymous reading and search engines from listing your site.