asp.net mvc - How to make FedAuth cookies unique for each application in on solution? -


i using system.identitymodel , claim based authentication authenticating mvc app. in login page after checking username , password uses approach create fedauth cookie(s) :

   var token = new sessionsecuritytoken(mycustomclaimsprincipal.getinstance(username, roles,claims)            );           token.ispersistent=rememberme;     var sam = federatedauthentication.sessionauthenticationmodule;    sam.isreferencemode = true;    sam.writesessiontokentocookie(token); 

everything works fine problem when use same approach in 2 other applications in same solution going published on different domains; in localhost fedauth cookies conflict each other. when log in 1 app, cookies not valid in other apps , should login again.

in fact can work 1 app @ same time. think on localhost , there no problem on different domains after publish. prefere make fedauth cookie unique each application in 1 solution. possible? , how? maybe possible context or contextid in constructor of sessionsequritytoken. did not found example that. not know send context , contextid params?

the sessionauthenticationmodule has member called cookiehandler (https://msdn.microsoft.com/en-us/library/microsoft.identitymodel.web.sessionauthenticationmodule_members.aspx) cookiehandler has name name of cookie. https://msdn.microsoft.com/en-us/library/microsoft.identitymodel.web.cookiehandler_members.aspx

you can you're doing in config <system.identitymodel.services> <federationconfiguration> <cookiehandler requiressl="false" name="yourcookienamehere"/> ...

</system.identitymodel.services>

hope helps


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -