Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

ASP.NET Core Identity - How to add new claims after initial login

$
0
0

Hi all,

I am trying to add new claims to the Identity after the initial login based on certain data that is queriedfrom database. The new claims that I am adding not persisting for subsequent requests.

In asp.net mvc when using OWIN, i did the following. 

        private static void UpdateAuthenticationResponseGrant(ClaimsIdentity identity)
        {
            var context = HttpContext.Current.Request.GetOwinContext();

            var authenticationContext =
                context.Authentication.AuthenticateAsync(DefaultAuthenticationTypes.ApplicationCookie);

            if (authenticationContext != null)
            {
                var authenticationManager = context.Authentication;
                authenticationManager.AuthenticationResponseGrant = new AuthenticationResponseGrant(
                    identity, new AuthenticationProperties { IsPersistent = true });
            }
        }

Is there is simiar way in ASP.NET Core to persist newly added claims. Appreciate any ideas on this.

Thanks,


Viewing all articles
Browse latest Browse all 9386

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>