Skip to content

Commit

Permalink
Replace string with MaaTokenPayload contant
Browse files Browse the repository at this point in the history
  • Loading branch information
cYKatherine committed Feb 6, 2025
1 parent 35851d1 commit ed3c07d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ private static void attest(ICoreAttestationService provider, Handler<AsyncResult

static Stream<Arguments> argumentProvider() {
return Stream.of(
Arguments.of("azure-cc"),
Arguments.of("azure-cc-aks")
Arguments.of(MaaTokenPayload.AZURE_CC_AKS_PROTOCOL),
Arguments.of(MaaTokenPayload.AZURE_CC_AKS_PROTOCOL)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public void testE2E() throws AttestationException {
var maaToken = "<Placeholder>";
var maaServerUrl = "https://sharedeus.eus.attest.azure.net";
var validator = new MaaTokenSignatureValidator(maaServerUrl);
var token = validator.validate(maaToken, "azure-cc");
var token = validator.validate(maaToken, MaaTokenPayload.AZURE_CC_ACI_PROTOCOL);
}

static Stream<Arguments> argumentProvider() {
return Stream.of(
Arguments.of("/com.uid2.shared/test/secure/azurecc/jwt_payload_aci.json", "azure-cc"),
Arguments.of("/com.uid2.shared/test/secure/azurecc/jwt_payload_aks.json", "azure-cc-aks")
Arguments.of("/com.uid2.shared/test/secure/azurecc/jwt_payload_aci.json", MaaTokenPayload.AZURE_CC_ACI_PROTOCOL),
Arguments.of("/com.uid2.shared/test/secure/azurecc/jwt_payload_aks.json", MaaTokenPayload.AZURE_CC_AKS_PROTOCOL)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private MaaTokenPayload generateBasicPayload() {
.vmDebuggable(false)
.runtimeData(generateBasicRuntimeData())
.ccePolicyDigest(CCE_POLICY_DIGEST)
.azureProtocol("azure-cc")
.azureProtocol(MaaTokenPayload.AZURE_CC_ACI_PROTOCOL)
.build();
}

Expand Down Expand Up @@ -145,7 +145,7 @@ public void testValidationSuccess_AksWithAzureSignedKataccUvm() throws Attestati
var aksPayload = generateBasicPayload()
.toBuilder()
.complianceStatus("azure-signed-katacc-uvm")
.azureProtocol("azure-cc-aks")
.azureProtocol(MaaTokenPayload.AZURE_CC_AKS_PROTOCOL)
.build();
var enclaveId = validator.validate(aksPayload, PUBLIC_KEY);
assertEquals(CCE_POLICY_DIGEST, enclaveId);
Expand All @@ -157,7 +157,7 @@ public void testValidationFailure_AksWithOtherUvm() {
var aksPayload = generateBasicPayload()
.toBuilder()
.complianceStatus("fake-compliance")
.azureProtocol("azure-cc-aks")
.azureProtocol(MaaTokenPayload.AZURE_CC_AKS_PROTOCOL)
.build();
Throwable t = assertThrows(AttestationException.class, ()-> validator.validate(aksPayload, PUBLIC_KEY));
assertEquals("Not run in Azure Compliance Utility VM", t.getMessage());
Expand Down

0 comments on commit ed3c07d

Please sign in to comment.