解决方法
据我所知,Azure AD目前不支持发布自定义声明.
作为解决方法,我们可以使用Azure AD Graph添加directory schema extensions.之后,我们可以使用Azure AD Graph获取数据扩展,并在验证安全令牌时添加自定义声明,如下所示:
app.USEOpenIdConnectAuthentication( new OpenIdConnectAuthenticationoptions { ClientId = clientId,Authority = authority,PostlogoutRedirectUri = postlogoutRedirectUri,Notifications = new OpenIdConnectAuthenticationNotifications { AuthenticationFailed = context => { context.HandleResponse(); context.Response.Redirect("/Error?message=" + context.Exception.Message); return Task.Fromresult(0); },SecurityTokenValidated = context => { //you can use the Azure AD Graph to read the custom data extension here and add it to the claims context.AuthenticationTicket.Identity.AddClaim(new System.Security.Claims.Claim("AddByMe","test")); return Task.Fromresult(0); } });@H_502_17@此外,如果您对Azure有任何想法或反馈,可以从here提交.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。