I'm using Spring security OAuth 2.0 authorization in a Spring Boot REST API. It works as expected in Postman tests but I don't succeed to make it working from Swagger "Try out". I'm using this post here: How to configure oAuth2 with password flow with Swagger ui in spring boot rest application. This is supposed to work but it doesn't in my case. I just need some clarification on the following method:
private SecurityContext securityContext() {
return SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.ant("/user/**"))
.build();
}
What the /user/** URL stands for ? Does it means that the defined security context should apply on all URL matching the pattern ? Or does it mean that this URL shall be called to get the user details ?
My code is exactly as the one in the post, however, after I fill in the dialog box with the user credentials and scopes, etc. I get "Auth ErrorTypeError: Failed to fetch" and whatever I do I can't get any usefull log message.
It might have something to do with CORS as the HTTP filters, which are called when I'm doing Postman tests, aren't called in this case.
Any suggestion please ?
Many thanks in advance.
Kind regards,
Nicolas