asp.net mvc - Skipping Azure ACS home realm discovery -
i've been looking way integrate azure acs home realm discovery page our asp.net mvc5 app login page rather use default 1 hosted on acs itself.
what want suggested here:
i’m building mvc 5.1 on .net 4.5.1 azure web role needs authenticate users multiple corporate identity providers – aad, adfs – , list grow on time. has been simple enough set-up azure acs federation provider. presents home realm discovery (hrd) page , flow works.
things become complicated when try , follow instructions adding hrd login page directly (following instructions given in acs application integration pages using home realm discovery metadata feed , example html + js). able present hrd buttons struggling wiring sign in process owin wsfederation setup, in application knows acs wsfederationmetadataurl.
i’ve got in configureauth method:
app.usewsfederationauthentication(wsfederationoptions: new wsfederationauthenticationoptions() { notifications = new wsfederationauthenticationnotifications() { redirecttoidentityprovider = (context) => { context.protocolmessage.whr = ".com"; return task.fromresult(0); } }, metadataaddress = cloudconfigurationmanager.getsetting("authentication.wsfederationmetadataurl"), wtrealm = cloudconfigurationmanager.getsetting("authentication.realm"), authenticationmode = authenticationmode.passive, });
where .com domain of 1 of idps in acs happens our own aad. doesn’t work. can scenario made work? found 1 relevant stack post talks skipping home realm discovery ws-federation owin middleware , allows whr parameter set via user action far haven’t been able work whr hard coded.
skipping home realm discovery ws-federation owin middleware
i’ve changed buttons example html+js post /account/externallogin controller action , owin pipeline way:
// post: /account/externallogin [httppost] [allowanonymous] [validateantiforgerytoken] public actionresult externallogin(string provider, string homerealm, string returnurl) { // request redirect external login provider return new challengeresult(provider, homerealm, url.action("externallogincallback", "account", new { returnurl = returnurl })); }
rather use cookie , navigate login page @ chosen home realm (as boiler plate html+js acs does) :
// sets cookie remember chosen identity provider , navigates it. function identityproviderbuttonclicked() { setcookie(this.getattribute("name")); window.location = this.getattribute("id"); return false; }
Comments
Post a Comment