IdentityServer4 - How to store refresh token into database using mysql.data?

前端 未结 2 621
隐瞒了意图╮
隐瞒了意图╮ 2021-01-18 16:09

I\'m new at IdentityServer4. I read I need to implement an IPersistedGrantStore to store refresh tokens into a table like PersistedGrants in my dat

2条回答
  •  -上瘾入骨i
    2021-01-18 16:24

    The key will be to implement IPersistedGrantStore using whatever backend you like, then to tell IdentityServer to use that implementation by registering the implementation in the dependency injection system.

    For example, if you call your implementation PersistedGrantStore, then you could register the implementation like this:

    services.AddTransient();

    You can see that essentially this is all that the EntityFramework implementation does, once you take away all the EntityFramework stuff.

    Later when IdentityServer wants to persist a grant, it will get your implementation and call the appropriate method. So you don't have to do anything, other than inject your implementation into IdentityServer so it can do whats needed.

提交回复
热议问题