Azure AD Authorization integration with spring boot resource server

Valsaraj Viswanathan 1 Reputation point
2022-05-15T02:55:55.04+00:00

We need to use Azure AD for authn and authz for a mobile app to post data into spring boot backend application. Generated access token using client credentials for testing and the Spring boot application is configured with jwk url to validate token and it works fine. We used spring starter oidc resource server dependency for this.
Next we need to configure role to the client and control access to the spring boot resource. We have created app role but it's not printed on the spring boot backend when we printed the granted authority on spring boot backend code. Anyone please share what is the correct way to configure Azure AD for this scenario and if anything additional needed to do on the spring boot?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,278 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 2022-05-15T05:14:07.01+00:00

    Hello @Valsaraj Viswanathan , take a look to Protect a resource server/API and Access other resource servers from a resource server and beyond for samples on how to protect your api using @PreAuthorize("hasRole|hasAuthority|etc") and more.

    Let us know if this answer was helpful to you. If so, please remember to accept it so that others in the community with similar questions can more easily find a solution.