Thank you for your quick response. One more question, I am using ComponentSpace inside an API to generate SAML Response. I used SamlIdentityProvider.InitiateSsoAsync(userID: , relayState: ); to generate SAML Response. The first error I got with the session store. Since my API is stateless, it doesn't have any cookie or session To store. for a quick dirty fix is I override the session store and injected it into my dependency injection. Is there any inbuild store that I can use for API's that are state less?
public class IdentityDistributedSsoSessionStore : DistributedSsoSessionStore { private readonly IOptionsSnapshot<DistributedSsoSessionStoreOptions> _distributedSsoSessionStoreOptions;
public IdentityDistributedSsoSessionStore(IOptionsSnapshot<DistributedSsoSessionStoreOptions> distributedSsoSessionStoreOptions, IDistributedCache distributedCache, IHttpRequest request, IHttpResponse response, ILoggerFactory loggerFactory) : base(distributedSsoSessionStoreOptions, distributedCache, request, response, loggerFactory) { _distributedSsoSessionStoreOptions = distributedSsoSessionStoreOptions; }
public override string SessionID { get {
string cookieValue = Guid.NewGuid().ToString(); //commented lines //AddCookie(_distributedSsoSessionStoreOptions.CookieName, cookieValue, _distributedSsoSessionStoreOptions.CookieOptions); // sessionID = cookieValue; return cookieValue; } } }
Dependency injection
services.AddScoped<ISsoSessionStore, IdentityDistributedSsoSessionStore>();
|