Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
Change claims value while keeping user logged in c# web api and jquery client

I have a web application which has different shift types that are accessed either by set users in the database for each shift. Or you can log in as a basic requester with your active directory account.

It's using OAuth token based authentication and when the user logs in its saving a shift type value passed from the shift originally selected.

identity.AddClaim(new Claim("shiftType", shiftID.ToString())); 

Database users can only access the shift they're assigned to, however I'd like AD users to be able to flip between shifts where its allowed. There are some shifts which for example if you logged in on shift 1, can view shift 2 but not 3. If someone wants to change from shift 1 and start viewing 2, how can I go about calling the API from Javascript and update the shiftType claim while keeping the user logged in and that update be found when accessing the APIs after. As I do checks on the controllers to make sure that the claim value is allowed to view a controller.

Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can go with Token Exchange. Even if you have your own backend which issues tokens, it will not be difficult to implement this standard. Your case is one that fits very well with Token Exchange - your client has an access token with a set of given claims, but needs an access token with a different set of claims. You will send the access token to the exchange endpoint, and the Authorization Server / backend will decide whether it can change claims for this user. If so, a new token will be issued and signed and returned to the client. This can still be the same user's token, so there will be no need to log the user in again.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!