我们正在尝试实现涉及两个应用程序的以下场景:
现在还应对APP1进行身份验证,因为它使用Azure B2C并在策略中配置了SSO。 我的问题是在步骤4中,APP1将无法识别用户已通过APP2登录AB2C。
var cookieAuthenticationOptions = new CookieAuthenticationOptions
{
CookieDomain = ".app.localhost",
CookieName = "IAMAuthentication",
ExpireTimeSpan = TimeSpan.FromMinutes(30),
SlidingExpiration = true,
CookieSecure = CookieSecureOption.SameAsRequest,
LoginPath = new PathString("/login"),
LogoutPath = new PathString("/logout"),
Provider = new CookieAuthenticationProvider
{
OnApplyRedirect = ApplyCookieRedirect
}
};
var openIdAuthOptions = new OpenIdConnectAuthenticationOptions
{
RedirectUri = RedirectUri,
ClientId = ClientId,
Authority = string.Format(AadInstance, ApiTenant, SignInPolicy),
TokenValidationParameters = new TokenValidationParameters { NameClaimType = "name", SaveSigninToken = true },
PostLogoutRedirectUri = RedirectUri
};
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(cookieAuthenticationOptions);
app.UseOpenIdConnectAuthentication(openIdAuthOptions);
app.UseStageMarker(PipelineStage.Authenticate);
答案 0 :(得分:0)
原来是租户中缺少的配置。