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"
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

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

    Is your authorization method a cookie or jwt?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    kalidarscope created

    Jwt

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • 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.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    kalidarscope created

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

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    maliming created
    Support Team

    Angular uses jwt by default

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    kalidarscope created

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

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    maliming created
    Support Team

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

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)