세션 consumer에 Revoke 추가

This commit is contained in:
2024-04-23 15:57:25 +09:00
parent fba613f83c
commit 0a65c6009e
2 changed files with 27 additions and 18 deletions

View File

@ -50,8 +50,8 @@ func (p *provider_redis) New(input *Authorization) (string, error) {
return "", err
}
p.redisClient.Del(p.ctx, sks...)
for _, sk := range sks {
p.redisClient.HSet(p.ctx, sk, "inv", "true")
p.redisClient.Publish(p.ctx, p.deleteChannel, sk).Result()
}
@ -323,7 +323,17 @@ func (c *consumer_redis) Revoke(pk string) {
sk := publickey_to_storagekey(publickey(pk))
c.redisClient.Del(c.ctx, string(sk))
c.redisClient.Publish(c.ctx, c.deleteChannel, string(sk)).Result()
c.lock.Lock()
defer c.lock.Unlock()
if sr, ok := c.stages[0].cache[sk]; ok {
c.stages[0].deleted[sk] = sr
}
if sr, ok := c.stages[1].cache[sk]; ok {
c.stages[1].deleted[sk] = sr
}
}
func (c *consumer_redis) IsRevoked(accid primitive.ObjectID) bool {