c# - Can you configure OWIN Cookie Authentication to prevent certain URLs from affecting sliding expiration? -


we have asp.net mvc 5 app using owin cookie authentication sliding expiration. on client, have script polls web service every minute notifications. prevent web service call causing auth token expiration sliding forward. there way that?

i considering implementing own custom sliding expiration method in onvalidateidentity handler, setting expiresutc in method doesn't appear affect token's expiration date.

app.usecookieauthentication(new cookieauthenticationoptions {     provider = new cookieauthenticationprovider     {         onvalidateidentity = cookievalidateidentitycontext =>         {             cookievalidateidentitycontext.properties.expiresutc = datetime.utcnow.addminutes(-1);             return task.fromresult(0);         }     },      authenticationtype = defaultauthenticationtypes.applicationcookie,     authenticationmode = authenticationmode.active,     loginpath = new pathstring("/"),     slidingexpiration = false,     logoutpath = new pathstring("/sessions/logout") }); 

any appreciated!

i haven't tested this, should work in theory:

app.use("/path1", app2 => app2.usecookieauthentication(...)); app.use("/path2", app3 => app3.usecookieauthentication(...)); app.usecookieauthentication(...); 

the ordering of use calls important. beautiful thing owin ability override behavior on subpaths.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -