asp.net - Supplement Windows Authentication Principal with custom properties -


i have webapp @ work uses ad authenticate users. works nicely, ie. adding roles ad long process have contractor takes care of windows network infrastructure. i'd merge roles , permissions (a custom implementation) db principal generated windows authentication.

basically, have following:

protected void application_authorizerequest(object sender, eventargs args) {       if (httpcontext.current != null)     {         string[] roles = null;          if (!userisregisteredlocally(user))             addusertodb(user);         else         {             roles = generaterolesfromappauthorizations(user);             roles.concat(generaterolesfromapppermissions(user));         }           claimsprincipal principal = new genericprincipal(user.identity, roles);            thread.currentprincipal = httpcontext.current.user = principal;     } } 

currently, every single request made server hit db verify if user registered locally (recorded in db). ideally, replace if, checking first time user navigates page (of given "browsing session") , indicate that user has been confirmed exist in db.

is there way me leverage windows authentication principal/identity indicate given user has been persisted or not?


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -