Is it possible to get ACS claims without editing web.config?

后端 未结 3 1957
无人及你
无人及你 2021-02-06 06:37

Is it possible to set up the realm URL, claim types, etc for azure ACS without editing the web.config? Can you set up these required elements programmatically somehow?

E

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 07:30

    Handle FederationConfigurationCreated event of FederatedAuthentication class, e.g. in Application_Start of Global.asax:

    void Application_Start(object sender, EventArgs e)
    {
        FederatedAuthentication.FederationConfigurationCreated += FCC;
    }
    
    private void FCC(object sender, FederationConfigurationCreatedEventArgs e)
    {
        e.FederationConfiguration.WsFederationConfiguration.PassiveRedirectEnabled = true;
        e.FederationConfiguration.WsFederationConfiguration.Issuer = "https://mynamespace.accesscontrol.windows.net/v2/wsfederation";
        e.FederationConfiguration.WsFederationConfiguration.Realm = "http://localhost:81/";
        e.FederationConfiguration.WsFederationConfiguration.RequireHttps = false;
    }
    

提交回复
热议问题