Azure token validation in springboot

chkashyap 6 Reputation points
2021-06-04T15:10:37.73+00:00

Hi, I’m having a hard time figuring out how to validate the azure tokens in the spring boot backend. The flow is the front end sends the azure generated token into the backend apis with the token in the header. The question is how to validate the token and send back the custom made apis response. FYI we have created an virtual app in the azure portal and have kept the security as accept requests only of the same tenant and not of any other tenant. Pls help me with this ..

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,149 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Marilee Turscak-MSFT 37,141 Reputation points Microsoft Employee
    2021-06-04T20:26:18.14+00:00

    You can use Spring Security to validate the token. There is an example here that shows this: https://github.com/Azure-Samples/ms-identity-java-webapi/tree/edbd399155341556e3871065d1b8b4be2e9cbce0

    There is also an announcement here that goes through the basic steps: https://azure.microsoft.com/en-us/blog/use-azure-active-directory-with-spring-security-5-0-for-oauth-2-0/


  2. Raghav Thakkar 1 Reputation point
    2022-03-15T20:18:15.447+00:00

    @chkashyap

    Are you able to valid azure ad token in API in spring boot?
    I am also facing the same issue.
    Could you please help if you find anything useful.
    Thanks.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.