Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prompt=login between Keycloak and Spring Security Oauth2

I am using Spring Security Oauth2 with keycloak 10 to authenticate my app users.

Can anyone tell me how to ask an authenticated user to provide his credentials again when trying to do sensitive actions on the app?

Keycloak has a parameter named prompt that must be forwarder from my app to keycloak, but I don't know how to do that.

Thanks for your help

like image 310
kazzy Avatar asked Dec 18 '25 11:12

kazzy


1 Answers

you can create a custom Oauth2AuthorizationRequestResolver Override the public OAuth2AuthorizationRequest resolve method and include prompt. Some more detail in this doc. https://docs.spring.io/spring-security/site/docs/5.1.7.RELEASE/reference/html/jc.html

This allows you to add custom properties to the authorize request.

like image 151
Wojciech Lesniak Avatar answered Dec 20 '25 01:12

Wojciech Lesniak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!