Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

How to integrate ADFS with episerver and handle return uri based on multisite

$
0
0

Hi,

My webapp host on DXC as mutiple sites and intergrated with ADFS.

I want to set Wtrealm property based on domain. But in startup it's init too early to catch domain name. So i can't handle return uri based on multisite

For examle:

if user access domain

  abc.com.sg then Wtrealm = abc.com.sg

  abc.com.vn then Wtrealm =   abc.com.vn

Code example

 public class Startup
    {
        const string LogoutUrl = "/util/logout.aspx";
        public void Configuration(IAppBuilder app)
        {
            // Add CMS integration for ASP.NET Identity
            app.AddCmsAspNetIdentity<SiteUser>();
            //app.AddCmsAspNetIdentity<SiteUser>(new ApplicationOptions()
            //{
            //    ConnectionStringName = _connectionStringHandler.Commerce.Name
            //});
            //federated authentication
            app.SetDefaultSignInAsAuthenticationType(WsFederationAuthenticationDefaults.AuthenticationType);
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType
            });
            app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions()
            {
                //URL to federation server meta data
                //AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType,
                MetadataAddress = ConfigurationManager.AppSettings["MetadataAddress"],
                //Value of Wtrealm must *exactly* match what is configured in the federation server
                Wtrealm = ConfigurationManager.AppSettings["AdfsWtRealm"],
                UseTokenLifetime = false,
                Notifications = new WsFederationAuthenticationNotifications()

Regards,

Thang Le


Viewing all articles
Browse latest Browse all 9076

Trending Articles