Skip to content

Commit 06c986f

Browse files
authored
xuy-UID2-5873-remove-gcp-vmid (#560)
* xuy-UID2-5873-remove-gcp-vmid * update * update pom.xml
1 parent c2e7007 commit 06c986f

File tree

11 files changed

+6
-735
lines changed

11 files changed

+6
-735
lines changed

pom.xml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -169,35 +169,20 @@
169169
<artifactId>sts</artifactId>
170170
</dependency>
171171
<dependency>
172-
<groupId>com.google.api-client</groupId>
173-
<artifactId>google-api-client</artifactId>
174-
<version>2.6.0</version>
172+
<groupId>com.google.http-client</groupId>
173+
<artifactId>google-http-client</artifactId>
174+
<version>1.45.0</version>
175175
</dependency>
176176
<dependency>
177-
<groupId>com.google.apis</groupId>
178-
<artifactId>google-api-services-compute</artifactId>
179-
<version>v1-rev20221205-2.0.0</version>
177+
<groupId>com.google.http-client</groupId>
178+
<artifactId>google-http-client-gson</artifactId>
179+
<version>1.45.0</version>
180180
</dependency>
181181
<dependency>
182182
<groupId>com.google.auth</groupId>
183183
<artifactId>google-auth-library-oauth2-http</artifactId>
184184
<version>1.30.0</version>
185185
</dependency>
186-
<dependency>
187-
<groupId>com.google.auth</groupId>
188-
<artifactId>google-auth-library-credentials</artifactId>
189-
<version>1.30.0</version>
190-
</dependency>
191-
<dependency>
192-
<groupId>com.google.cloud</groupId>
193-
<artifactId>google-cloud-logging</artifactId>
194-
<version>3.15.12</version>
195-
</dependency>
196-
<dependency>
197-
<groupId>com.google.protobuf</groupId>
198-
<artifactId>protobuf-java</artifactId>
199-
<version>3.25.5</version>
200-
</dependency>
201186
<dependency>
202187
<groupId>com.azure</groupId>
203188
<artifactId>azure-security-attestation</artifactId>

src/main/java/com/uid2/shared/Const.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ public static class Config {
3232

3333
public static final String UidInstanceIdPrefixProp = "uid_instance_id_prefix";
3434

35-
// GCP
36-
public static final String GoogleCredentialsProp = "google_credentials";
37-
public static final String GcpEnclaveParamsProp = "gcp_enclave_params";
38-
3935
// Azure
4036
public static final String MaaServerBaseUrlProp = "maa_server_base_url";
4137

src/main/java/com/uid2/shared/attest/AttestationFactory.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ public static IAttestationProvider getNitroAttestation() throws Exception {
1212
return (IAttestationProvider) c.newInstance();
1313
}
1414

15-
public static IAttestationProvider getGcpVmidAttestation() throws Exception {
16-
Class<?> cls = Class.forName("com.uid2.attestation.gcp.VmidAttestationProvider");
17-
Constructor<?> c = cls.getConstructor();
18-
return (IAttestationProvider) c.newInstance();
19-
}
20-
2115
public static IAttestationProvider getGcpOidcAttestation() throws Exception {
2216
Class<?> cls = Class.forName("com.uid2.attestation.gcp.OidcAttestationProvider");
2317
Constructor<?> c = cls.getConstructor();

src/main/java/com/uid2/shared/cloud/CloudUtils.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
package com.uid2.shared.cloud;
22

3-
import com.google.api.services.compute.ComputeScopes;
4-
import com.google.auth.oauth2.GoogleCredentials;
53
import com.uid2.shared.Const;
6-
import com.uid2.shared.Utils;
74
import io.vertx.core.json.JsonObject;
85
import org.slf4j.Logger;
96
import org.slf4j.LoggerFactory;
107

11-
import java.io.ByteArrayInputStream;
128
import java.net.*;
139
import java.nio.file.Path;
14-
import java.util.Collections;
1510

1611
public class CloudUtils {
1712
private static final Logger LOGGER = LoggerFactory.getLogger(CloudUtils.class);
@@ -49,42 +44,6 @@ public static TaggableCloudStorage createStorage(String cloudBucket) {
4944
);
5045
}
5146

52-
public static GoogleCredentials getGoogleCredentialsFromConfig(JsonObject jsonConfig) {
53-
GoogleCredentials credentials = getGoogleCredentialsFromConfigInternal(jsonConfig);
54-
if (credentials != null && credentials.createScopedRequired()) {
55-
// only needs compute readonly scope
56-
LOGGER.info("Requesting scope: " + ComputeScopes.COMPUTE_READONLY);
57-
credentials.createScoped(Collections.singletonList(ComputeScopes.COMPUTE_READONLY));
58-
}
59-
return credentials;
60-
}
61-
62-
private static GoogleCredentials getGoogleCredentialsFromConfigInternal(JsonObject jsonConfig) {
63-
if (System.getenv("GOOGLE_APPLICATION_CREDENTIALS") != null) {
64-
try {
65-
GoogleCredentials ret = GoogleCredentials.getApplicationDefault();
66-
LOGGER.info("Using GOOGLE_APPLICATION_CREDENTIALS from environment");
67-
return ret;
68-
69-
} catch (Exception ex) {
70-
LOGGER.error("Unable to read google credentials " + ex.getMessage(), ex);
71-
return null;
72-
}
73-
}
74-
75-
try {
76-
String encodedCreds = jsonConfig.getString(Const.Config.GoogleCredentialsProp);
77-
if (encodedCreds == null) return null;
78-
byte[] credentials = Utils.decodeBase64String(encodedCreds);
79-
if (credentials == null) return null;
80-
GoogleCredentials ret = GoogleCredentials.fromStream(new ByteArrayInputStream(credentials));
81-
LOGGER.info("Using google_credentials provided through vertx-config (env or config)");
82-
return ret;
83-
} catch (Exception ex) {
84-
LOGGER.error("Unable to read google credentials " + ex.getMessage(), ex);
85-
return null;
86-
}
87-
}
8847

8948
public static String normalizeFilePath(Path path) {
9049
return normalizFilePath(path.toString());

src/main/java/com/uid2/shared/secure/GcpVmidCoreAttestationService.java

Lines changed: 0 additions & 125 deletions
This file was deleted.

src/main/java/com/uid2/shared/secure/gcp/InstanceDocument.java

Lines changed: 0 additions & 82 deletions
This file was deleted.

src/main/java/com/uid2/shared/secure/gcp/InstanceDocumentVerifier.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)