Auto logout Application when AD Session ends

Prabhakar.Billingi 66 Reputation points
2020-07-10T09:37:17.6+00:00

I am developing a java web application(say demoApp) to have Azure AD sign in using Auth grant flow. Using User sign-in frequency I have configured AD session to 1 hour. Now I have two sessions demoApp session and Azure AD session.

My Question is:

  1. How would demoApp understand if AD Session is expired.
  2. Should my demoApp need to poll AD periodically to check if AD session timed out, so I can force user to logout of demoApp and re-authenticate or any other approach.
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,455 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AmanpreetSingh-MSFT 56,561 Reputation points
    2020-07-10T10:37:42.75+00:00

    @9982c2a9-df9e-49ee-8db8-68420607ec20

    After 1 hour, the DemoApp will reject access token with 401 unauthorized error. So your code needs to handle the refresh of the access token. At refresh of access token/ session cookie, login.microsoftonline.com can reject refresh token/session cookie with error: prompt required - handle that error and initiate a prompt for authentication. MSAL (Microsoft Authentication Library) does this out of the box. 3rd party libraries need exception handling.


    Please do not forget to "Accept the answer" wherever the information provided helps you. This will help others in the community as well.


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.