Compare commits

..

2 Commits

Author SHA1 Message Date
Stavros 6ff7e111b8 fix: fix typo in get code entry 2026-06-02 12:46:27 +03:00
Stavros b636e6ff57 fix: use withlock for get oidc code entry 2026-06-02 12:14:10 +03:00
+18 -8
View File
@@ -465,19 +465,29 @@ func (service *OIDCService) ValidateGrantType(grantType string) error {
}
func (service *OIDCService) GetCodeEntry(codeHash string, clientId string) (*AuthorizeCodeEntry, bool) {
entry, ok := service.caches.code.Get(codeHash)
var entry AuthorizeCodeEntry
var ok bool
service.caches.code.WithLock(func(actions CacheStoreActions[AuthorizeCodeEntry]) {
entry, ok = actions.Get(codeHash)
if !ok {
return
}
if entry.ClientID != clientId {
ok = false
return
}
// Since the code can only be used once, we delete it from the cache after retrieving it
actions.Delete(codeHash)
})
if !ok {
return nil, false
}
if entry.ClientID != clientId {
return nil, false
}
// Since the code can only be used once, we delete it from the cache after retrieving it
service.caches.code.Delete(codeHash)
return &entry, true
}