Base solution for your next web application
Open Closed

How to change Current Session Values #6721


User avatar
0
kalidarscope created

We need to change current session value

 if (string.IsNullOrEmpty(user.EnvironmentId) == false)
            {
                claim.Identities.First().AddClaim(new Claim("Envid", ""));
            }

i tried to

ASAPSessions.Envid="new session"

7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Is your authorization method a cookie or jwt?

  • User Avatar
    0
    kalidarscope created

    Jwt

  • User Avatar
    0
    maliming created
    Support Team

    JWT is self-contained with Claims. If you want to implement update claims, it will be very complicated.

    I suggest you query based on user ID, etc. instead of storing it in claims(session).

    By the way, jwt will show the cliams plain text to the client.

  • User Avatar
    0
    kalidarscope created

    What is the default authorization used in ASP.NET Core and Angular? We are using default authentication.

  • User Avatar
    0
    maliming created
    Support Team

    Angular uses jwt by default

  • User Avatar
    0
    kalidarscope created

    Added the new claim, it has my session value. But we get the injected value in session.

  • User Avatar
    0
    maliming created
    Support Team

    JWT itself contains all the Claims, you can't modify it on the back end.