Hello -
We are having similar issue as mentioned here:
https://www.componentspace.com/Forums/11640/Initiate-and-Assert-happens-in-different-domain
I’ve tried the proscribed solution, but the call to the set the domain is never executed.
services.Configure(options =>
{
// this code is never executed
options.CookieOptions = new CookieOptions()
{
Domain = “xyz.com”
};
});
Is there a change i need to make using more recent update? We’re using Saml2 4.2 version. Running .NET 6.
Please advise.
Thanks!
Mike Oliver
TeamDynamix, Inc.
Hi Mike,
There are a few options for maintaining SAML session state. The link you included is for when session state is saved in the actual cookie. By default, we use a different mechanism where the cookie is an index into session state stored in a distributed cache. For that case, the code should be:
using ComponentSpace.Saml2.Session;
builder.Services.Configure(options =>
{
options.CookieOptions = new ComponentSpace.Saml2.Bindings.CookieOptions()
{
Domain = “xyz.com”
};
});
[quote][/quote]
Hi Mike,
There are a few options for maintaining SAML session state. The link you included is for when session state is saved in the actual cookie. By default, we use a different mechanism where the cookie is an index into session state stored in a distributed cache. For that case, the code should be:
using ComponentSpace.Saml2.Session;
builder.Services.Configure(options =>
{
options.CookieOptions = new ComponentSpace.Saml2.Bindings.CookieOptions()
{
Domain = "xyz.com"
};
});
There are a few options for maintaining SAML session state. The link you included is for when session state is saved in the actual cookie. By default, we use a different mechanism where the cookie is an index into session state stored in a distributed cache. For that case, the code should be:
using ComponentSpace.Saml2.Session;
builder.Services.Configure(options =>
{
options.CookieOptions = new ComponentSpace.Saml2.Bindings.CookieOptions()
{
Domain = "xyz.com"
};
});
Hi - thanks. As it turns out, I just figured this out as well :) One correction to your code, I believe. It should be something like this instead:
services.Configure(options => {
options.CookieOptions?.Domain = AppServices.IsLocal ? "localhost" : "xyz.com";
});
That way, a developer can still test locally and also the other properties of the CookieOptions object are kept (since you're not instantiating a new CookieOptions object).
- Mike
Good idea.