79632485

Date: 2025-05-21 17:30:35
Score: 1
Natty:
Report link

TLDR;

spring security couldn't find the jwkUri. Adding the line below fixed the issue.

.jwkSetUri(realmUrl + "/certs")

Ok so after adding the DEBUG option for spring security, which I completely forgot existed. I didn't get much wiser. There were no errors or anything of value shown in the DEBUG logs.

When I went digging some more in the docs I found the 'failureHandler'

.failureHandler((request, response, exception) -> {
                            exception.printStackTrace();
                            response.sendRedirect("/login?error=" + URLEncoder.encode(exception.getMessage(), StandardCharsets.UTF_8));
                        })

This showed that it couldn't find the jwk uri. After adding this line:

.jwkSetUri(realmUrl + "/certs")

to my clientRegistrationRepository, everything worked.

Thanks for the push in the right direction Toerktumlare

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Zouffke