1

是否可以在同一个 Web API 中使用两种不同的身份验证“路径”,即一个使用 Active Directory 联合身份验证服务 (ADFS) 进行身份验证,一个使用身份框架进行身份验证?

是否像执行以下操作一样简单?

pubilc void ConfigureAuth(IAppBuilder app)
{ 
    oauthauthorizationserveroptions oauthserveroptions = new oauthauthorizationserveroptions()
    {
       allowinsecurehttp = true,
       tokenendpointpath = new pathstring("/token"),
       accesstokenexpiretimespan = timespan.fromdays(30),
       provider = new simpleauthorizationserverprovider(),
       refreshtokenprovider = new simplerefreshtokenprovider()
    };

    activedirectoryfederationservicesbearerauthenticationoptions  adfsauthoptions = new activedirectoryfederationservicesbearerauthenticationoptions()
    {
       metadataendpoint = configurationmanager.appsettings["federationmetadatalocation"]
    };

    app.useoauthauthorizationserver(oauthserveroptions);
    app.useoauthbearerauthentication(new oauthbearerauthenticationoptions());
    app.useactivedirectoryfederationservicesbearerauthentication(adfsauthoptions);
}
4

0 回答 0