@@ -111,7 +111,6 @@ func migrateSessionsToSQLAndValidate(ctx context.Context,
111
111
112
112
overrideSessionTimeZone (kvSession )
113
113
overrideSessionTimeZone (migratedSession )
114
- overrideMacaroonRecipe (kvSession , migratedSession )
115
114
116
115
if ! reflect .DeepEqual (kvSession , migratedSession ) {
117
116
diff := difflib.UnifiedDiff {
@@ -329,33 +328,3 @@ func overrideSessionTimeZone(session *Session) {
329
328
session .RevokedAt = fixTime (session .RevokedAt )
330
329
}
331
330
}
332
-
333
- // overrideMacaroonRecipe overrides the MacaroonRecipe for the SQL session in a
334
- // certain scenario:
335
- // In the bbolt store, a session can have a non-nil macaroon struct, despite
336
- // both the permissions and caveats being nil. There is no way to represent this
337
- // in the SQL store, as the macaroon permissions and caveats are separate
338
- // tables. Therefore, in the scenario where a MacaroonRecipe exists for the
339
- // bbolt version, but both the permissions and caveats are nil, we override the
340
- // MacaroonRecipe for the SQL version and set it to a MacaroonRecipe with
341
- // nil permissions and caveats. This is needed to ensure that the deep equals
342
- // check in the migration validation does not fail in this scenario.
343
- // Additionally, if either the permissions or caveats aren't set, for the
344
- // MacaroonRecipe, that is represented as empty array in the SQL store, but
345
- // as nil in the bbolt store. Therefore, we also override the permissions
346
- // or caveats to nil for the migrated session in that scenario, so that the
347
- // deep equals check does not fail in this scenario either.
348
- func overrideMacaroonRecipe (kvSession * Session , migratedSession * Session ) {
349
- if kvSession .MacaroonRecipe != nil {
350
- kvPerms := kvSession .MacaroonRecipe .Permissions
351
- kvCaveats := kvSession .MacaroonRecipe .Caveats
352
-
353
- if kvPerms == nil && kvCaveats == nil {
354
- migratedSession .MacaroonRecipe = & MacaroonRecipe {}
355
- } else if kvPerms == nil {
356
- migratedSession .MacaroonRecipe .Permissions = nil
357
- } else if kvCaveats == nil {
358
- migratedSession .MacaroonRecipe .Caveats = nil
359
- }
360
- }
361
- }
0 commit comments