Reputation: 61
I'm using spring boot security with keycloak to security my app. But I have both normal web browser request (using thymeleaf template), and rest api request (no browser and the method in Controller annotated with @ResponseBody with json format).
From the web guider, I found keycloak will used different client type for browser request (e.g. public client) and for no UI reqeust (bearer-only), and the session in SecurityConfig.java is different, new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl())
and new NullAuthenticatedSessionStrategy()
.
So my question is how could I configure the spring security and keycloak for both support browser reqeust and rest api request in one app?
Thanks!
Upvotes: 3
Views: 1184
Reputation: 31679
Having a bearer-only
client makes sense only when you've got another client to authenticate with. In short, these are the three types of client types in Keycloak:
Having said that, I don't see the point in making the same application both public and bearer only. As a rule, you make a client per application. So you've got two choices:
Upvotes: 2