Skip to content

Commit 1381b9f

Browse files
authored
fix: federated token middleware (#2432)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent 6f25c5b commit 1381b9f

File tree

1 file changed

+7
-7
lines changed
  • app/controlplane/internal/server

1 file changed

+7
-7
lines changed

app/controlplane/internal/server/grpc.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,17 @@ func craftMiddleware(opts *Opts) []middleware.Middleware {
234234
usercontext.WithAttestationContextFromAPIToken(opts.APITokenUseCase, opts.OrganizationUseCase, logHelper),
235235
// 2.c - Set Attestation context from user token
236236
usercontext.WithAttestationContextFromUser(opts.UserUseCase, logHelper),
237-
// Validate the CAS Backend is fully configured and valid
238-
selector.Server(
239-
usercontext.ValidateCASBackend(opts.CASBackendUseCase),
240-
usercontext.BlockIfCASBackendNotValid(opts.CASBackendUseCase),
241-
).Match(requireFullyConfiguredCASBackendMatcher()).Build(),
242-
// Store all memberships in the context
243-
usercontext.WithCurrentMembershipsMiddleware(opts.MembershipUseCase),
244237
// 2.d - Set its robot account from federated delegation
245238
usercontext.WithAttestationContextFromFederatedInfo(opts.OrganizationUseCase, logHelper),
239+
// Store all memberships in the context
240+
usercontext.WithCurrentMembershipsMiddleware(opts.MembershipUseCase),
246241
// 3 - Update API Token last usage
247242
usercontext.WithAPITokenUsageUpdater(opts.APITokenUseCase, logHelper),
243+
// 4 - Validate the CAS Backend is fully configured and valid
244+
selector.Server(
245+
usercontext.ValidateCASBackend(opts.CASBackendUseCase),
246+
usercontext.BlockIfCASBackendNotValid(opts.CASBackendUseCase),
247+
).Match(requireFullyConfiguredCASBackendMatcher()).Build(),
248248
).Match(requireRobotAccountMatcher()).Build(),
249249
)
250250

0 commit comments

Comments
 (0)