Auth0 Home Blog Docs

Java API Access Authenticated Principle Meta Data



I’m using the Java Spring Boot/Security API ( within my REST API. This will be the back end service for my Vue.js front end which and will use Json Web Tokens as the authentication and authorization mechanism. I have followed the quick start guide and seems pretty straight forward.

The issue I have is that my application is multi tenant. I will hold the tenant identifier in the user’s app meata data and I need to access that in the back end service. My question is; how do I access the authenitcated principle via the auth0-spring-security-api package?

I can see the Principle object can be accessed in AuthenticationJsonWebToken#getPrinciple function. Can anyone show me how I get a handle on the AuthenticationJsonWebToken in my Controller? I assume I need to type cast something from the Spring Security package such as the Authenitcaiton instance?

Mnay thanks