asp.net – Azure AD B2C – 多个子域
发布时间:2020-12-16 09:55:40 所属栏目:asp.Net 来源:网络整理
导读:我可以设置Azure Active Directory B2C以使用多个子域吗? 这是我到目前为止所做的: 设置一个B2C目录 创建了一个Web应用程序:mytest.com – 此应用程序中的身份验证和授权工作正常. 我创建了另一个应用程序:subdomain.mytest.com – 它使用相同的Azure B2
我可以设置Azure Active Directory B2C以使用多个子域吗?
这是我到目前为止所做的: >设置一个B2C目录 现在,我想要的是:当我登录“mytest.com”时也登录到“subdomain.mytest.com” 这可能吗 ? 我的应用程序是使用OpenId Connect的ASP.NET MVC应用程序 谢谢 解决方法
使它工作的线:
app.UseCookieAuthentication(new CookieAuthenticationOptions(){CookieDomain =“.mytest.com”}); 当我读到这篇文章时,我想通了:https://auth0.com/blog/2014/01/27/ten-things-you-should-know-about-tokens-and-cookies/(第3节) public void ConfigureAuth(IAppBuilder app) { app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions() { CookieDomain = ".mytest.com"}); var options = new OpenIdConnectAuthenticationOptions { ClientId = clientIdb2c,RedirectUri = redirectUri,PostLogoutRedirectUri = redirectUri,Notifications = new OpenIdConnectAuthenticationNotifications() { MessageReceived = (context) => { //AADB2C90091: The user has cancelled entering self-asserted information. if (!string.IsNullOrEmpty(context.ProtocolMessage.ErrorDescription) && !context.ProtocolMessage.ErrorDescription.StartsWith("AADB2C90091:",StringComparison.OrdinalIgnoreCase)) { if (context.ProtocolMessage.ErrorDescription.StartsWith("AADB2C99002",StringComparison.OrdinalIgnoreCase)) { throw new SecurityTokenValidationException("User does not exist. Please sign up before you can sign in."); } } return Task.FromResult(0); },RedirectToIdentityProvider = OnRedirectToIdentityProvider,AuthenticationFailed = AuthenticationFailed,SecurityTokenValidated = (context) => { //Create the logic to redirect here. context.AuthenticationTicket.Properties.RedirectUri = "https://sub1.mytest.com"; return Task.FromResult(0); } },Scope = "openid offline_access",ResponseType = "id_token",// The PolicyConfigurationManager takes care of getting the correct Azure AD authentication // endpoints from the OpenID Connect metadata endpoint. It is included in the PolicyAuthHelpers folder. ConfigurationManager = new PolicyConfigurationManager( String.Format(CultureInfo.InvariantCulture,aadInstance,tenant,"/v2.0",OIDCMetadataSuffix),new string[] { SignUpPolicyId,SignInPolicyId,ProfilePolicyId }),}; app.USEOpenIdConnectAuthentication(options); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net核心 – dotnet cli – “检测包降级”
- asp.net mvc 之旅 —— 第六站 ActionFilter的应用及源码分
- 具有EntityDataSource的一个ASP.NET GridView中的两个相关数
- ASP.NET Core Web API从静态类登录
- asp.net – 从静态类访问Page的当前实例
- asp.net-mvc – LINQ to SQL分页和COUNT(*)
- asp.net-mvc – ASP.NET MVC;使用EditorTemplates编辑集合,
- asp.net-mvc – ASP MVC中的“@”是什么意思/做什么?
- asp.net-core – Visual Studio 2017 RC安装会中断Visual S
- Kestrel 是一个跨平台的适用于 ASP.NET Core 的 Web 服务器
推荐文章
站长推荐
- asp.net-mvc – Razor并在ActionLinks上指定css类
- asp.net-mvc – Pro ASP.Net MVC 3实体框架体育商
- asp.net-mvc-4 – 在MVC4中使用DotNetOpenAuth获
- asp.net – 找不到与名为’help’的控制器匹配的
- asp.net-web-api – SimpleInjector RegisterWeb
- asp.net-mvc – 使用具有Razor视图的Spark主布局
- asp.net-mvc – “无法同时分析32位和64位应用程
- Asp.Net 5核心1.0不兼容/模板未找到
- asp.net-mvc – 为什么我的ActionFilters都没有运
- asp.net – 如何查询具有多个根和过滤的嵌套集模
热点阅读