1 回答
TA贡献1877条经验 获得超6个赞
只需实现IPersistedGrantStore下面的类似代码,您就可以完全控制持久授权,您可以添加新列来存储。
public class PersistStore : IPersistedGrantStore
{
private readonly IPersistedGrandStoreService _persistedGrandStore;
public PersistStore(IPersistedGrandStoreService persistedGrandStore)
{
_persistedGrandStore = persistedGrandStore;
}
public Task StoreAsync(PersistedGrant grant)
{
return _persistedGrandStore.AddAsync(grant.ToPersistedGrantModel());
}
public async Task<PersistedGrant> GetAsync(string key)
{
var grant = await _persistedGrandStore.GetAsync(key);
return grant.ToPersistedGrant();
}
public async Task<IEnumerable<PersistedGrant>> GetAllAsync(string subjectId)
{
var grants = await _persistedGrandStore.GetAllAsync(subjectId);
return grants.ToPersistedGrants();
}
public Task RemoveAsync(string key)
{
return _persistedGrandStore.RemoveAsync(key);
}
public Task RemoveAllAsync(string subjectId, string clientId)
{
return _persistedGrandStore.RemoveAllAsync(subjectId, clientId);
}
public Task RemoveAllAsync(string subjectId, string clientId, string type)
{
return _persistedGrandStore.RemoveAllAsync(subjectId, clientId, type);
}
}
- 1 回答
- 0 关注
- 65 浏览
添加回答
举报