Angular Get Spring Roles from JWT

Viewed 2602

I have two roles in my REST back-end (built with Spring):

ROLE_USER, ROLE_ADMIN

When I log in, the REST API returns a valid token. Then I set it in the local storage like this:

localStorage.setItem('currentUser', JSON.stringify({username: username, token: token}));

And when I need it I get it like this:

localStorage.getItem('currentUser');

So far so good. When I get my token how do I get the payload and the claims in it?

I want to show admin panel if you are an admin.

3 Answers
Related