Azure AD PostAuthentication添加声明 [英] Azure AD PostAuthentication add claims
问题描述
我正在使用Azure AD对用户进行身份验证。我想添加一些针对我的应用程序的用户声明。我应该在global.asax的Application_PostAuthenticateRequest`中执行此操作吗?有没有办法我也可以缓存我的声明?
I am using Azure AD to authenticate the users. I want to add few user claims specific to my application. Should I do it in Application_PostAuthenticateRequest` in global.asax ?. Is there a way I can cache my claims too ?
推荐答案
如果使用的是ASP.NET OWIN中间件,则有特定的您可以用于此目的的通知。以这种方式添加的声明将最终出现在会话cookie中,因此您无需在后续调用中重复声明增强逻辑。参见 http://www.cloudidentity.com/blog/2015/08/26/augmenting-the-set-of-incoming-claims-with-the-openid -connect-and-oauth2-middleware-katana-3-x / 了解详情。
If you are using the ASP.NET OWIN middleware, there are specific notifications you can use for that purpose. Claims added in that way will end up in your session cookie, so that you won't have to repeat the claims augmentation logic in subsequent calls. See http://www.cloudidentity.com/blog/2015/08/26/augmenting-the-set-of-incoming-claims-with-the-openid-connect-and-oauth2-middleware-in-katana-3-x/ for details.
这篇关于Azure AD PostAuthentication添加声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!