forked from baron/baron-sso
feat(user): support fixed UUID registration and enhance bulk import results
- Added support for fixed UUIDs during bulk registration (Search-first + ExternalID mapping) - Implemented idempotency and visibility restoration for soft-deleted users - Enhanced bulk upload UI to show 'New/Updated/Unchanged' status and modified fields - Added logic to reclaim identifiers (login_id) from colliding records - Added frontend E2E and backend unit tests for UUID integrity and conflict handling - Fixed i18n, formatting, and mock tests to satisfy code-check - Applied 'go fix' for 'omitzero' tags and general Go standards
This commit is contained in:
@@ -70,7 +70,7 @@ func TestHeadlessJWKSCacheService_EnsureFreshKeySet_UsesCachedJWKSWhenFresh(t *t
|
||||
CachedKids: []string{"cached-key"},
|
||||
CachedAt: &now,
|
||||
LastCheckedAt: &now,
|
||||
ExpiresAt: ptrTestTime(now.Add(30 * time.Minute)),
|
||||
ExpiresAt: new(now.Add(30 * time.Minute)),
|
||||
LastRefreshStatus: "success",
|
||||
ConsecutiveFailures: 0,
|
||||
})
|
||||
@@ -114,7 +114,7 @@ func TestHeadlessJWKSCacheService_EnsureFreshKeySet_RefreshesWhenKidMissing(t *t
|
||||
CachedKids: []string{"stale-key"},
|
||||
CachedAt: &now,
|
||||
LastCheckedAt: &now,
|
||||
ExpiresAt: ptrTestTime(now.Add(30 * time.Minute)),
|
||||
ExpiresAt: new(now.Add(30 * time.Minute)),
|
||||
LastRefreshStatus: "success",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@@ -181,7 +181,7 @@ func TestHeadlessJWKSCacheService_ShouldPrefetch_SkipsUntilNextRetryAt(t *testin
|
||||
ClientID: "client-headless",
|
||||
LastRefreshStatus: "failure",
|
||||
ConsecutiveFailures: 3,
|
||||
NextRetryAt: ptrTestTime(now.Add(10 * time.Minute)),
|
||||
NextRetryAt: new(now.Add(10 * time.Minute)),
|
||||
}
|
||||
|
||||
assert.False(t, cacheService.ShouldPrefetch(state, now))
|
||||
@@ -216,7 +216,7 @@ func TestHeadlessJWKSCacheWorker_RunOnce_SkipsBackoffTargets(t *testing.T) {
|
||||
JWKSURI: clients[1].HeadlessJWKSURI(),
|
||||
LastRefreshStatus: "failure",
|
||||
ConsecutiveFailures: 3,
|
||||
NextRetryAt: ptrTestTime(now.Add(10 * time.Minute)),
|
||||
NextRetryAt: new(now.Add(10 * time.Minute)),
|
||||
}))
|
||||
|
||||
fetchCounts := map[string]int{}
|
||||
@@ -278,7 +278,7 @@ func TestHeadlessJWKSCacheWorker_RunOnce_RetriesAfterBackoffAndClearsFailureStat
|
||||
LastRefreshStatus: "failure",
|
||||
LastError: "previous failure",
|
||||
ConsecutiveFailures: 3,
|
||||
NextRetryAt: ptrTestTime(time.Now().Add(-time.Minute)),
|
||||
NextRetryAt: new(time.Now().Add(-time.Minute)),
|
||||
}))
|
||||
|
||||
fetchCount := 0
|
||||
@@ -353,7 +353,7 @@ func TestHeadlessJWKSCacheWorker_RunOnce_MixedClients(t *testing.T) {
|
||||
JWKSURI: skipClient.HeadlessJWKSURI(),
|
||||
LastRefreshStatus: "failure",
|
||||
ConsecutiveFailures: 3,
|
||||
NextRetryAt: ptrTestTime(time.Now().Add(10 * time.Minute)),
|
||||
NextRetryAt: new(time.Now().Add(10 * time.Minute)),
|
||||
}))
|
||||
|
||||
fetchCounts := map[string]int{}
|
||||
@@ -416,8 +416,9 @@ func mustServiceHeadlessRSAJWK(t *testing.T, kid string) (*rsa.PrivateKey, jose.
|
||||
return privateKey, jose.JSONWebKeySet{Keys: []jose.JSONWebKey{publicJWK}}
|
||||
}
|
||||
|
||||
//go:fix inline
|
||||
func ptrTestTime(value time.Time) *time.Time {
|
||||
return &value
|
||||
return new(value)
|
||||
}
|
||||
|
||||
func newTestHeadlessClient(clientID, jwksURI string) domain.HydraClient {
|
||||
|
||||
Reference in New Issue
Block a user