@@ -12,6 +12,8 @@ public class PermitConfig {
1212 private final String opa ;
1313 private final String apiUrl ;
1414 private final Boolean debugMode ;
15+ private final Boolean proxyFactsViaPdp ;
16+ private final int factsSyncTimeout ;
1517
1618 // logger config
1719 private final String logLevel ;
@@ -45,6 +47,8 @@ private PermitConfig(Builder builder) {
4547 this .defaultTenant = builder .defaultTenant ;
4648 this .useDefaultTenantIfEmpty = builder .useDefaultTenantIfEmpty ;
4749 this .context = builder .context ;
50+ this .proxyFactsViaPdp = builder .proxyFactsViaPdp ;
51+ this .factsSyncTimeout = builder .factsSyncTimeout ;
4852 String runtimeVersion = Permit .class .getPackage ().getImplementationVersion ();
4953 this .version = (runtimeVersion == null ) ? defaultVersion : runtimeVersion ;
5054 }
@@ -95,6 +99,24 @@ public Boolean isDebugMode() {
9599 return debugMode ;
96100 }
97101
102+ /**
103+ * Returns whether the facts via the PDP API instead of using the default Permit REST API
104+ *
105+ * @return {@code true} if proxying facts via the PDP is enabled, {@code false} otherwise.
106+ */
107+ public Boolean isProxyFactsViaPdp () {
108+ return proxyFactsViaPdp ;
109+ }
110+
111+ /**
112+ * Returns the timeout for facts synchronization.
113+ *
114+ * @return The facts synchronization timeout.
115+ */
116+ public int getFactsSyncTimeout () {
117+ return factsSyncTimeout ;
118+ }
119+
98120 /**
99121 * Returns the log level configured for the Permit SDK Logger.
100122 *
@@ -208,6 +230,8 @@ public static class Builder {
208230 private String opa = "http://localhost:8181" ;
209231 private String apiUrl = "https://api.permit.io" ;
210232 private Boolean debugMode = false ;
233+ private Boolean proxyFactsViaPdp = false ;
234+ private int factsSyncTimeout = 0 ;
211235
212236 // logger config
213237 private String logLevel = "info" ;
@@ -279,6 +303,28 @@ public Builder withDebugMode(Boolean debugMode) {
279303 return this ;
280304 }
281305
306+ /**
307+ * Configures whether the SDK should proxy facts via the PDP API instead of using the default Permit REST API.
308+ *
309+ * @param proxyFactsViaPdp The proxy facts via PDP mode to be set.
310+ * @return The updated {@code Builder} object.
311+ */
312+ public Builder withProxyFactsViaPdp (Boolean proxyFactsViaPdp ) {
313+ this .proxyFactsViaPdp = proxyFactsViaPdp ;
314+ return this ;
315+ }
316+
317+ /**
318+ * Configures the timeout for facts synchronization.
319+ *
320+ * @param factsSyncTimeout The facts synchronization timeout to be set.
321+ * @return The updated {@code Builder} object.
322+ */
323+ public Builder withFactsSyncTimeout (int factsSyncTimeout ) {
324+ this .factsSyncTimeout = factsSyncTimeout ;
325+ return this ;
326+ }
327+
282328 /**
283329 * Sets the log level configured for the Permit SDK Logger.
284330 *
0 commit comments