c# - Authentication in an ASP.NET web application using Azure AD -


i'm looking @ using azure ad handle user accounts web app.

i've implemented similar microsoft's sample code shown here (linked here).

it uses following authentication scenario (this):

azure ad authentication scenario web browser web application

as far understand it, once the user authenticated, owin creates , sets own session cookie specific domain. long cookie hasn't expired or become corrupted, user stay logged in. our app ever talks authentication provider when user logs out or logs in again.

so raises question: happens when user deactivated, or deleted, ad while still logged in?

let's have sensitive information stored in web app's database modifiable authorized users. permissions authorization kept in local database keyed user's oid.

bob administrator our company's web app. reasons undisclosed, have had terminate employment. our domain administrator locks ad account out , bob escorted out of premises. should fine.

everything not fine.

disgruntled bob arrives home , looks @ laptop, browser open on our web app. thinks, "surely must have been locked out?". browses administration part of site , sees still able access it. in petty way own @ company, goes in , modifies of sensitive information.

bob still authenticated (bob's credentials still identify bob), should no longer authorized access service. however, session cookie still valid. bob still logged in , can still has access web app until cookie expires, or until ends session.

how can stop happening? (besides not sleeping bob's wife.)

a few "solutions" have thought of:

  1. call azure's graph api every [authorize] action, returns whether user valid , not locked out. then make user end own session.

  2. call user metadata table on application every [authorize] action checks if user disabled or not. (not ideal: disparity between ad , local db)

  3. use bearerauthentication how. (help appreciated, examples can find web-api)

  4. do nothing , deal unlikely situation (not ideal)

as long cookie hasn't expired or become corrupted, user stay logged in.

not true.

both oauth2 , ws-fed tokens contain token expiration date among other attributes.

thus, in reality, bob able use application until expiration date in token passes. token providers issue tokens valid few hours @ most.


Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -