ASP.Net How to implement authentication/authorization with token reevaluation between several systems

I have:

  1. Several legacy SQL tables with custom user, roles/claims data
  2. WinForms fat client in which user creation/changing belongs
  3. Asp.net project which uses those tables to make cookie/jwt on login and to authorize some api methods
  4. New asp.net web api services upcoming which still need to authorize users

So main problem is user data changing. User logins in web project, asp.net generate cookie/jwt based on current roles/claims which can be eventually used in authorization (without database call). But how can I actually knew if this data is still actual? How can I track moment, when it’s changed?

As far as I understand, basic flow of authentication/authorization if I use ASP.Net identity is:
User logins in system, system generates cookie/jwt with user info (roles and claims too)
This token is used in authorization. And as far as token is valid, we don’t make additional database calls. When I change user role through asp.net identity it invalidates token (?) and with next request cookie/jwt will be generated again based on actual data.

So I will be grateful if you share any thoughts about those topics. Especially:

  1. Do I understand correctly basic flow, especially a part with minimizing database roundtrips and storing roles/claims inside token.
  2. What is a preferable way of dealing with user data actualization across multiple systems
  3. Is it actually bad to check user data on every request to authorize him? Or to load user into context with his roles/claims on every request? We talk about system with 1-3k users workload

What I thought about:

  1. Simple solution is to check user data on authorization through database call. If api can be used only with some claim/role, we make database call and check that user has it. It works, but obviously it will scale poorly, especially because of many asynchronous calls from client.
  2. Changing reevaluation settings of token. For example, change settings of cookie so it will reevaluates every minute. So even if change roles/claims, we don’t need to logout/login, after one minute we will regenerate token again with actual data. But with greater periods we will get more stale data.
  3. Add some “stamp” columns to tables, which will be changed on update. In this case we can make database calls to check if any data has changed, and if so, we will reload all data to token. In this case we still need to make calls to database, but at least we will not load any data most of time.
  4. Make separate ASP.NET authentication/authorization server with identity in which all user creation/changing functional will belong. And on each request we will contact our server, which will check if token is valid and so on. I’m not even sure if it should works like this or will it gain some potential scalabillity

New contributor

Elgik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật