Skip to content

Commit f665d55

Browse files
committed
fix: review comments and remove non needed tests
1 parent da7e0e3 commit f665d55

3 files changed

Lines changed: 11 additions & 316 deletions

File tree

‎internal/repository/integration_test.go‎

Lines changed: 0 additions & 136 deletions
This file was deleted.

‎internal/service/oidc_consent_test.go‎

Lines changed: 0 additions & 180 deletions
This file was deleted.

‎internal/service/oidc_service.go‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"os"
1717
"path/filepath"
1818
"strings"
19+
"sync"
1920
"time"
2021

2122
"slices"
@@ -163,6 +164,10 @@ type OIDCService struct {
163164
usedCode *cache.CacheStore[UsedCodeEntry]
164165
authorize *cache.CacheStore[AuthorizeRequest]
165166
}
167+
168+
mus struct {
169+
consent *sync.RWMutex
170+
}
166171
}
167172

168173
type OIDCServiceInput struct {
@@ -977,6 +982,9 @@ func (service *OIDCService) GetPrompt(prompt string) []OIDCPrompt {
977982
}
978983

979984
func (service *OIDCService) GetOIDCConsent(ctx context.Context, username, clientId string) (*repository.OidcConsent, error) {
985+
service.mus.consent.RLock()
986+
defer service.mus.consent.RUnlock()
987+
980988
entry, err := service.queries.GetOIDCConsentByUsernameAndClientID(ctx, repository.GetOIDCConsentByUsernameAndClientIDParams{
981989
Username: username,
982990
ClientID: clientId,
@@ -993,6 +1001,9 @@ func (service *OIDCService) GetOIDCConsent(ctx context.Context, username, client
9931001
}
9941002

9951003
func (service *OIDCService) UpsertOIDCConsent(ctx context.Context, username, scope, clientId string) (repository.OidcConsent, error) {
1004+
service.mus.consent.Lock()
1005+
defer service.mus.consent.Unlock()
1006+
9961007
existing, err := service.GetOIDCConsent(ctx, username, clientId)
9971008

9981009
if err != nil {

0 commit comments

Comments
 (0)