File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
main/java/com/uid2/shared/secure/gcpoidc
test/java/com/uid2/shared/secure/gcpoidc Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ public class PolicyValidator implements IPolicyValidator {
3030 public static final String ENV_DEBUG_MODE = "DEBUG_MODE" ;
3131 public static final String ENV_SKIP_VALIDATIONS = "SKIP_VALIDATIONS" ;
3232
33- public static final String EU_REGION_PREFIX = "europe" ;
34-
3533 private static final List <String > REQUIRED_ENV_OVERRIDES = ImmutableList .of (
3634 ENV_ENVIRONMENT ,
3735 ENV_OPERATOR_API_KEY_SECRET_NAME
@@ -88,13 +86,13 @@ private static String checkWorkload(TokenPayload payload) throws AttestationExce
8886 return payload .getWorkloadImageDigest ();
8987 }
9088
91- // We don't support to launch UID2 instance in EU .
92- // Currently, there's no GCP serving options in China mainland, so we will skip the check for CN.
89+ // Verify that region is specified .
90+ // Currently, there's no GCP serving options in China mainland, so we skip the check for CN.
9391 // More details about zone in https://cloud.google.com/compute/docs/regions-zones.
9492 private static String checkRegion (TokenPayload payload ) throws AttestationException {
9593 var region = payload .getGceZone ();
96- if (Strings .isNullOrEmpty (region ) || region . startsWith ( EU_REGION_PREFIX ) ){
97- throw new AttestationClientException ("Region is not supported. Value: " + region , AttestationFailure .BAD_FORMAT );
94+ if (Strings .isNullOrEmpty (region )){
95+ throw new AttestationClientException ("Region is not specified." , AttestationFailure .BAD_FORMAT );
9896 }
9997 return region ;
10098 }
Original file line number Diff line number Diff line change @@ -87,13 +87,12 @@ public void testValidationFailure_NotConfidentialSpace() {
8787 }
8888
8989 @ Test
90- public void testValidationFailure_EURegion () {
90+ public void testValidationSuccess_EURegion () {
9191 var validator = new PolicyValidator (ATTESTATION_URL );
9292 var payload = generateBasicPayload ().toBuilder ()
9393 .gceZone ("europe-north1-a" )
9494 .build ();
95- var e = assertThrows (AttestationException .class , () -> validator .validate (payload ));
96- assertEquals (AttestationFailure .BAD_FORMAT , ((AttestationClientException ) e ).getAttestationFailure ());
95+ assertDoesNotThrow (() -> validator .validate (payload ));
9796 }
9897
9998 @ Test
You can’t perform that action at this time.
0 commit comments