From 2c315f3116907977da7a010d7944a4d918f496bb Mon Sep 17 00:00:00 2001 From: gideonsmila Date: Sun, 22 Dec 2024 10:45:32 +0200 Subject: [PATCH] fix-comments: change opa url --- build.gradle | 3 +-- src/main/java/io/permit/sdk/PermitConfig.java | 2 +- src/main/java/io/permit/sdk/enforcement/Enforcer.java | 4 ++-- src/test/java/io/permit/sdk/PermitE2ETestBase.java | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index b473bd7..cc9bfec 100644 --- a/build.gradle +++ b/build.gradle @@ -36,8 +36,7 @@ repositories { java { toolchain { - languageVersion = JavaLanguageVersion.of(8) - // languageVersion = JavaLanguageVersion.of(17) + languageVersion = JavaLanguageVersion.of(8) } // sources are required by maven central in order to accept the package withSourcesJar() diff --git a/src/main/java/io/permit/sdk/PermitConfig.java b/src/main/java/io/permit/sdk/PermitConfig.java index 4f1afc1..9e6b439 100644 --- a/src/main/java/io/permit/sdk/PermitConfig.java +++ b/src/main/java/io/permit/sdk/PermitConfig.java @@ -205,7 +205,7 @@ public static class Builder { // main config vars private String token; private String pdp = "http://localhost:7766"; - private String opa = "http://localhost:8181/v1/data/permit"; + private String opa = "http://localhost:8181"; private String apiUrl = "https://api.permit.io"; private Boolean debugMode = false; diff --git a/src/main/java/io/permit/sdk/enforcement/Enforcer.java b/src/main/java/io/permit/sdk/enforcement/Enforcer.java index 0b3e90b..b755f5d 100644 --- a/src/main/java/io/permit/sdk/enforcement/Enforcer.java +++ b/src/main/java/io/permit/sdk/enforcement/Enforcer.java @@ -471,8 +471,8 @@ public UserPermissions getUserPermissionsWithOPA(GetUserPermissionsQuery input) String requestBody = gson.toJson(outerMap); RequestBody body = RequestBody.create(requestBody, MediaType.parse("application/json")); - - String url = String.format("%s/user_permissions/permissions", this.config.getOpaAddress()); + String PERMISSIONS_PATH = "permit/user_permissions/permissions"; + String url = String.format("%s/v1/data/%s", this.config.getOpaAddress(), PERMISSIONS_PATH); Request request = new Request.Builder() .url(url) .post(body) diff --git a/src/test/java/io/permit/sdk/PermitE2ETestBase.java b/src/test/java/io/permit/sdk/PermitE2ETestBase.java index 46e7e05..2ec9fc9 100644 --- a/src/test/java/io/permit/sdk/PermitE2ETestBase.java +++ b/src/test/java/io/permit/sdk/PermitE2ETestBase.java @@ -19,7 +19,7 @@ public abstract class PermitE2ETestBase { public PermitE2ETestBase() { final String token = System.getenv().getOrDefault("PDP_API_KEY", ""); final String pdpAddress = System.getenv().getOrDefault("PDP_URL", "http://localhost:7766"); - final String opaAddress = System.getenv().getOrDefault("OPA_URL", "http://localhost:8181/v1/data/permit"); + final String opaAddress = System.getenv().getOrDefault("OPA_URL", "http://localhost:8181"); final String pdpControlPlane = System.getenv().getOrDefault("PDP_CONTROL_PLANE", "https://api.permit.io"); this.config = new PermitConfig.Builder(token)