@@ -111,7 +111,6 @@ func migrateSessionsToSQLAndValidate(ctx context.Context,
111111
112112 overrideSessionTimeZone (kvSession )
113113 overrideSessionTimeZone (migratedSession )
114- overrideMacaroonRecipe (kvSession , migratedSession )
115114
116115 if ! reflect .DeepEqual (kvSession , migratedSession ) {
117116 diff := difflib.UnifiedDiff {
@@ -329,24 +328,3 @@ func overrideSessionTimeZone(session *Session) {
329328 session .RevokedAt = fixTime (session .RevokedAt )
330329 }
331330}
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- func overrideMacaroonRecipe (kvSession * Session , migratedSession * Session ) {
344- if kvSession .MacaroonRecipe != nil {
345- kvPerms := kvSession .MacaroonRecipe .Permissions
346- kvCaveats := kvSession .MacaroonRecipe .Caveats
347-
348- if kvPerms == nil && kvCaveats == nil {
349- migratedSession .MacaroonRecipe = & MacaroonRecipe {}
350- }
351- }
352- }
0 commit comments