Add ADFS verification support for Azure Web Site 2 Use ADFS, azureadfs in code
Next we will create an ASP. Net Program for MVC 5.0 and deploy it on the Azure Web Site.
Use Visual Studio 2015 to create a Web Project and change the authentication method at the place where the ASP.net template is selected.
Public void ConfigureAuth (IAppBuilder app) {app. setdefadefasigninasauthenticationtype (CookieAuthenticationDefaults. authenticationType); app. useCookieAuthentication (new CookieAuthenticationOptions (); app. useWsFederationAuthentication (new WsFederationAuthenticationOptions {Wtrealm = realm, MetadataAddress = adfsMetadata, BackchannelCertificateValidator = null ,});}
Open Global. asax. cs and add the following code:
Protected void Application_Start () {AreaRegistration. registerAllAreas (); FilterConfig. registerGlobalFilters (GlobalFilters. filters); RouteConfig. registerRoutes (RouteTable. routes); BundleConfig. registerBundles (BundleTable. bundles); ServicePointManager. serverCertificateValidationCallback = delegate {return true ;};}
After the code is added, you can publish the Web Project to the Azure Web Site.
In this case, we use a browser to open the published Web Site address, which will automatically jump to the ADFS logon interface.
Here we can use the AD account in the enterprise to log on to our Web Site.
Here are more detailed Blog posts from foreigners. For more information about good English, refer:
Http://www.tuicool.com/articles/NrMZ7v2