Hi I am new to both JHipster and Stackoverflow. I tried asking the same question on Should OAuth2RefreshtokensWebFilter Be Used Some Where? however, it was removed for some reason; hence, I am asking duplicate question.
Could you please share if there is an example of how to use this filter?
I have tried to add OAuth2RefreshtokensWebFilter to the method SecurityFilterChain filterChain(HttpSecurity http) however Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); is resolved as null in the filter.
Here is how I have added the filter
.and() //JHiPSTER Geneated
.addFilterAfter(oAuth2RefreshTokensWebFilter, OAuth2LoginAuthenticationFilter.class)
.oauth2Client(); //JHiPSTER Geneated
I am experimenting using Keycloak as SSO provider and the object is being resolved properly at SecurityContextHolder.getContext().getAuthentication() when tried to add it in the aacouts resource just for debugging. This proves that the Filter is called before the login, even after defining to invoke after login.
What is the correct way of adding this filter?