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
Post a Comment