Skip to content

Commit

Permalink
Throw AttestationClientException when protocol not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
cYKatherine committed Feb 5, 2025
1 parent 9f806e6 commit 1fdbb7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/main/java/com/uid2/shared/secure/Protocol.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.uid2.shared.secure;

public enum Protocol {
GCP_OIDC,
AWS_NITRO,
GCP_VMID,
AZURE_CC_ACI,
AZURE_CC_AKS,


}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.uid2.shared.secure.azurecc;

import com.uid2.shared.secure.AttestationClientException;
import com.uid2.shared.secure.AttestationException;
import lombok.Builder;
import lombok.Value;

Expand All @@ -26,11 +28,13 @@ public boolean isSevSnpVM(){
return SEV_SNP_VM_TYPE.equalsIgnoreCase(attestationType);
}

public boolean isUtilityVMCompliant(){
public boolean isUtilityVMCompliant() {
if (azureProtocol == AZURE_CC_ACI_PROTOCOL) {
return AZURE_COMPLIANT_UVM.equalsIgnoreCase(complianceStatus);
} else if (azureProtocol == AZURE_CC_AKS_PROTOCOL) {
return AZURE_COMPLIANT_UVM_AKS.equalsIgnoreCase(complianceStatus);
} else {
throw new AttestationClientException(String.format("Azure protocol: %s not supported", azureProtocol), INVALID_PROTOCOL)
}
return false;
}
Expand Down

0 comments on commit 1fdbb7d

Please sign in to comment.