Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

Question about ITicketStore and ApplicationCookie.SessionStore injection #624

@Schlurcher

Description

@Schlurcher

I'm currently playing around with cookies and session storage, as mentioned in the title. I'm trying to write an ITicketStore which uses an IDistrubutedCache to store the AuthTickets.

SqlServerCache is nice enough to provide an extension method to add it to ServiceCollection as IDistributedCache, so no problems there.

services.AddSqlServerCache(options => { options.ConnectionString = Configuration["Data:DefaultConnection:ConnectionString"]; }); 

My ctor looks like this: SqlServerCacheTicketStore(IDistributedCache cache)

So far so good, but this is where I ran into a problem. How do I register my ITicketStore for injection into CookeAuthOptions.SessionStore? I tried adding it to the ServiceCollection:

services.AddTransient<ITicketStore, SqlServerCacheTicketStore>() 

But this doesn't work, probably because CookieAuthOptions serves as the basis for other Cookies (TwoFactor, External, etc.), and there is no way to indicate for which cookie you wan't the ITicketStore injected?

Is the only way to wire up everything manually for CookieAuthOptions.SessionStorage? Or am I completely off track here and doing something dumb anyways? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions