[keycloak-user] How to only protect specific paths (SPA)

Marek Posolda mposolda at redhat.com
Tue Oct 10 08:13:00 EDT 2017


Can't you "compute" value of the onLoad attribute based on the current 
path? I maybe not understand your usecase properly, so maybe not the 
best solution, just guessing...

Marek

On 09/10/17 15:54, Mehdi Mehdi wrote:
> Hello everyone and thank you for sharing keycloak with the community.
>
> I'm trying to use keycloak on my SPA (single page application with javascript in both front & back ends).
>
> I only want to password protect specific paths and not all paths. The problem is that once I do require login
>
> keycloak.init( {onLoad: 'login-required'})...
> on some "sensitive path" all the other paths become protected. I suspected that would happen because I did not find a function to suspend "requiring a login".
>
> Indeed, I did test this by going to the keycloak admin page and logged out the user (who was by then on a public/not-protected path). On my SPA the user got kikked out asking her for a password through keycloak even though she was on a 'public path'.
>
> In short, is there a way to instruct keycloak not to require a login.
>
> BTW, I'm only using keycloak on the front end right now.. Need to make it work before also using it on my API (back end).
>
> Thank you in advance for your feedback.
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user




More information about the keycloak-user mailing list