I have build a oauth2 server using Spring boot 2.0.8 which uses Spring 5.0.8. The oauth server works and I receive an access token. I can verify that my ResourceServerConfigurerAdapter works because when I access a url with the incorrect access token I get an authentication error so the authentication server + resource server section works.
I want to create an endpoint that other microservices use call to get the current loggedin user. So I created an endpoint like this:
I startup Postman, request a new access token, do a call to /user with the access token supplied as bearer token and start the request. No matter what I do principal is always null. I have even added @AuthenticationPrincipal to the Principal principal argument and yet principal is null. I have also tried the following: