@@ -87,6 +87,8 @@ public class CoreVerticle extends AbstractVerticle {
8787
8888 private final FileSystem fileSystem ;
8989
90+ private static final String OPERATOR_TYPE = "operator_type" ;
91+
9092 public CoreVerticle (ICloudStorage cloudStorage ,
9193 IAuthorizableProvider authProvider ,
9294 AttestationService attestationService ,
@@ -185,27 +187,31 @@ private Router createRoutesSetup() {
185187 .allowedHeader ("Content-Type" ));
186188 router .route ().failureHandler (new GenericFailureHandler ());
187189
190+ final boolean enableAuditLog = true ;
191+ final AuditParams auditParams = new AuditParams ();
192+
188193 router .post (Endpoints .ATTEST .toString ())
189- .handler (new AttestationFailureHandler ())
190- .handler (auth .handleWithAudit (this ::handleAttestAsync , new AuditParams (), true , Role .OPERATOR , Role .OPTOUT_SERVICE ));
191- router .get (Endpoints .CLOUD_ENCRYPTION_KEYS_RETRIEVE .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleCloudEncryptionKeysRetrieval ), new AuditParams (), true , Role .OPERATOR ));
192- router .get (Endpoints .SITES_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleSiteRefresh ), new AuditParams (), true , Role .OPERATOR ));
193- router .get (Endpoints .KEY_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeyRefresh ), new AuditParams (), true , Role .OPERATOR ));
194- router .get (Endpoints .KEY_ACL_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeyAclRefresh ), new AuditParams (), true , Role .OPERATOR ));
195- router .get (Endpoints .KEY_KEYSET_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeysetRefresh ), new AuditParams (), true , Role .OPERATOR ));
196- router .get (Endpoints .KEY_KEYSET_KEYS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeysetKeyRefresh ), new AuditParams (), true , Role .OPERATOR ));
197- router .get (Endpoints .SALT_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleSaltRefresh ), new AuditParams (), true , Role .OPERATOR ));
198- router .get (Endpoints .CLIENTS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleClientRefresh ), new AuditParams (), true , Role .OPERATOR ));
199- router .get (Endpoints .CLIENT_SIDE_KEYPAIRS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleClientSideKeypairRefresh ), new AuditParams (), true , Role .OPERATOR ));
200- router .get (Endpoints .SERVICES_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleServiceRefresh ), new AuditParams (), true , Role .OPERATOR ));
201- router .get (Endpoints .SERVICE_LINKS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleServiceLinkRefresh ), new AuditParams (), true , Role .OPERATOR ));
202- router .get (Endpoints .OPERATORS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleOperatorRefresh ), new AuditParams (), true , Role .OPTOUT_SERVICE ));
203- router .get (Endpoints .PARTNERS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handlePartnerRefresh ), new AuditParams (), true , Role .OPTOUT_SERVICE ));
194+ .handler (new AttestationFailureHandler ())
195+ .handler (auth .handleWithAudit (this ::handleAttestAsync , new AuditParams (Collections .emptyList (), Arrays .asList ("application_name" , "application_version" , OPERATOR_TYPE , "components" )),
196+ enableAuditLog , Role .OPERATOR , Role .OPTOUT_SERVICE ));
197+ router .get (Endpoints .CLOUD_ENCRYPTION_KEYS_RETRIEVE .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleCloudEncryptionKeysRetrieval ), auditParams , enableAuditLog , Role .OPERATOR ));
198+ router .get (Endpoints .SITES_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleSiteRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
199+ router .get (Endpoints .KEY_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeyRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
200+ router .get (Endpoints .KEY_ACL_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeyAclRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
201+ router .get (Endpoints .KEY_KEYSET_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeysetRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
202+ router .get (Endpoints .KEY_KEYSET_KEYS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleKeysetKeyRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
203+ router .get (Endpoints .SALT_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleSaltRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
204+ router .get (Endpoints .CLIENTS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleClientRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
205+ router .get (Endpoints .CLIENT_SIDE_KEYPAIRS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleClientSideKeypairRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
206+ router .get (Endpoints .SERVICES_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleServiceRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
207+ router .get (Endpoints .SERVICE_LINKS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleServiceLinkRefresh ), auditParams , enableAuditLog , Role .OPERATOR ));
208+ router .get (Endpoints .OPERATORS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleOperatorRefresh ), auditParams , enableAuditLog , Role .OPTOUT_SERVICE ));
209+ router .get (Endpoints .PARTNERS_REFRESH .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handlePartnerRefresh ), auditParams , enableAuditLog , Role .OPTOUT_SERVICE ));
204210 router .get (Endpoints .OPS_HEALTHCHECK .toString ()).handler (this ::handleHealthCheck );
205- router .get (Endpoints .OPERATOR_CONFIG .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleGetConfig ), new AuditParams (), true , Role .OPERATOR ));
211+ router .get (Endpoints .OPERATOR_CONFIG .toString ()).handler (auth .handleWithAudit (attestationMiddleware .handle (this ::handleGetConfig ), auditParams , enableAuditLog , Role .OPERATOR ));
206212
207213 if (Optional .ofNullable (ConfigStore .Global .getBoolean ("enable_test_endpoints" )).orElse (false )) {
208- router .route (Endpoints .ATTEST_GET_TOKEN .toString ()).handler (auth .handleWithAudit (this ::handleTestGetAttestationToken , new AuditParams (), true , Role .OPERATOR ));
214+ router .route (Endpoints .ATTEST_GET_TOKEN .toString ()).handler (auth .handleWithAudit (this ::handleTestGetAttestationToken , auditParams , enableAuditLog , Role .OPERATOR ));
209215 }
210216
211217 return router ;
@@ -312,7 +318,7 @@ private void handleAttestAsync(RoutingContext rc) {
312318 }
313319 }
314320
315- if (json .containsKey ("operator_type" ) && !operator .getOperatorType ().name ().equalsIgnoreCase (json .getString ("operator_type" ))) {
321+ if (json .containsKey (OPERATOR_TYPE ) && !operator .getOperatorType ().name ().equalsIgnoreCase (json .getString (OPERATOR_TYPE ))) {
316322 setAttestationFailureReason (rc , AttestationFailure .INVALID_TYPE , Collections .singletonMap ("reason" , AttestationFailure .INVALID_TYPE .explain ()));
317323 Error ("attestation failure; invalid operator type" , 403 , rc , null );
318324 return ;
0 commit comments