我有用于使用ADFS登录的旧代码,但现在对通过AzureAD登录具有其他要求。联合身份验证库中的方法可以与ADFS一起使用,但不适用于Azure AD。
public static void RedirectToIdentityProvider(string db_, string realmIdentifier_, FederationConfig config_)
{
try
{
var returnurl = "http://localhost/6420";
FederationDatabaseFunctions db = new FederationDatabaseFunctions(db_);
FederationData federationData = db.GetFederatedDataByRealm(realmIdentifier_);
TrustedIssuerFederationMetadata metadata = new TrustedIssuerFederationMetadata(federationData);
WSFederationAuthenticationModule wsFAM = new WSFederationAuthenticationModule();
wsFAM.PassiveRedirectEnabled = true;
wsFAM.RequireHttps = true;
wsFAM.PersistentCookiesOnPassiveRedirects = false;
wsFAM.Issuer = "https://sts.windows.net/27010d87-5b00-4131-b6fd-fde8346ce198/";
wsFAM.Realm = "https://login.microsoftonline.com/";
wsFAM.RedirectToIdentityProvider(returnurl, returnurl, false);
}
catch { throw; }
}
我收到404错误,但发行人绝对正确。是否有其他要传递给AzureAD的参数。
注意:我已经设法通过OWIN启动在单独的MVC项目中登录AzureAD,但如果可能的话,理想情况下,我需要使用现有设置进行复制。
这是提供404的网址:这是我返回的网址:Go toolchain