11package app .component ;
22
3+ import common .Const ;
34import common .EnvUtil ;
45import common .HttpClient ;
56import common .Mapper ;
910import java .util .Map ;
1011
1112public class Core extends App {
12- private static final String CORE_API_TOKEN = EnvUtil .getEnv ("UID2_E2E_CORE_API_TOKEN" );
13- private static final String OPTOUT_TO_CALL_CORE_API_TOKEN = EnvUtil .getEnv ("UID2_E2E_OPTOUT_TO_CALL_CORE_API_TOKEN" );
14- public static final String CORE_URL = EnvUtil .getEnv ("UID2_E2E_CORE_URL" );
15- public static final String OPTOUT_URL = EnvUtil .getEnv ("UID2_E2E_OPTOUT_URL" );
13+ private static final String OPERATOR_API_KEY = EnvUtil .getEnv (Const . Config . Core . OPERATOR_API_KEY );
14+ private static final String OPTOUT_API_KEY = EnvUtil .getEnv (Const . Config . Core . OPTOUT_API_KEY );
15+ public static final String CORE_URL = EnvUtil .getEnv (Const . Config . Core . CORE_URL );
16+ public static final String OPTOUT_URL = EnvUtil .getEnv (Const . Config . Core . OPTOUT_URL );
1617
1718 public Core (String host , Integer port , String name ) {
1819 super (host , port , name );
@@ -23,7 +24,7 @@ public Core(String host, String name) {
2324 }
2425
2526 public JsonNode attest (String attestationRequest ) throws Exception {
26- String response = HttpClient .post (getBaseUrl () + "/attest" , attestationRequest , CORE_API_TOKEN );
27+ String response = HttpClient .post (getBaseUrl () + "/attest" , attestationRequest , OPERATOR_API_KEY );
2728 return Mapper .OBJECT_MAPPER .readTree (response );
2829 }
2930
@@ -35,12 +36,12 @@ public JsonNode getWithCoreApiToken(String path, boolean encrypted) throws Excep
3536 Map <String , String > headers = new HashMap <>();
3637 if (encrypted )
3738 headers .put ("Encrypted" , "true" );
38- String response = HttpClient .get (getBaseUrl () + path , CORE_API_TOKEN , headers );
39+ String response = HttpClient .get (getBaseUrl () + path , OPERATOR_API_KEY , headers );
3940 return Mapper .OBJECT_MAPPER .readTree (response );
4041 }
4142
4243 public JsonNode getWithOptOutApiToken (String path ) throws Exception {
43- String response = HttpClient .get (getBaseUrl () + path , OPTOUT_TO_CALL_CORE_API_TOKEN );
44+ String response = HttpClient .get (getBaseUrl () + path , OPTOUT_API_KEY );
4445 return Mapper .OBJECT_MAPPER .readTree (response );
4546 }
4647}
0 commit comments