Request.IsAuthenticated function in Asp.Net 5 -


is there equivalent request.isauthenticated in asp.net 5 hidden somewhere or expected loop through user's identities , determine ourselves?

if need know if user object authenticated, property should trick:

user.identity.isauthenticated 

if need prevent action being called unauthenticated user, following attribute class works great.

public class basicauthattribute : actionfilterattribute, iauthenticationfilter {     public void onauthentication(authenticationcontext filtercontext)     {     }      public void onauthenticationchallenge(authenticationchallengecontext filtercontext)     {         var user = filtercontext.httpcontext.user;         if (user == null || !user.identity.isauthenticated)         {             filtercontext.result = new httpunauthorizedresult();         }     } } 

i use in base controller class follows.

[basicauth] public abstract class baseauthorizedcontroller : controller 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -