Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 59 additions & 53 deletions jans-cedarling/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public MultiIssuerAuthorizeResult authorizeMultiIssuer(
throw new IllegalArgumentException("resource must not be null");
}
EntityData resourceObj = EntityData.Companion.fromJson(resource.toString());
String contextStr = context != null ? context.toString() : "{}";
return cedarling.authorizeMultiIssuer(tokens, action, resourceObj, contextStr);
JsonValue contextJson = context != null ? new JsonValue(context.toString()) : null;
return cedarling.authorizeMultiIssuer(tokens, action, resourceObj, contextJson);
}

// ── authorize_unsigned ──────────────────────────────────────────────
Expand Down Expand Up @@ -159,7 +159,7 @@ public AuthorizeResult authorizeUnsignedEntity(
}
EntityData resourceObj = EntityData.Companion.fromJson(resource.toString());
String contextStr = context != null ? context.toString() : "{}";
return cedarling.authorizeUnsigned(principal, action, resourceObj, contextStr);
return cedarling.authorizeUnsigned(principal, action, resourceObj, new JsonValue(contextStr));
}

// ── authorize_unsigned_batch ────────────────────────────────────────
Expand Down Expand Up @@ -264,8 +264,8 @@ public BatchItem batchItemFromJson(
throw new IllegalArgumentException("resource must not be null");
}
EntityData resourceObj = EntityData.Companion.fromJson(resource.toString());
String contextStr = context != null ? context.toString() : null;
return new BatchItem(resourceObj, action, contextStr);
JsonValue contextJson = context != null ? new JsonValue(context.toString()) : null;
return new BatchItem(resourceObj, action, contextJson);
}

/**
Expand Down Expand Up @@ -362,7 +362,7 @@ public void pushDataCtx(String key, JSONObject value, Long ttlSecs) throws DataE
if (value == null) {
throw new DataException.SerializationException("value cannot be null");
}
cedarling.pushDataCtx(key, value.toString(), ttlSecs);
cedarling.pushDataCtx(key, new JsonValue(value.toString()), ttlSecs);
}

/**
Expand All @@ -382,7 +382,7 @@ public void pushDataCtx(String key, String value, Long ttlSecs) throws DataExcep
if (value == null) {
throw new DataException.SerializationException("value cannot be null");
}
cedarling.pushDataCtx(key, value, ttlSecs);
cedarling.pushDataCtx(key, new JsonValue(value), ttlSecs);
}

/**
Expand Down Expand Up @@ -416,12 +416,12 @@ public void pushDataCtx(String key, String value) throws DataException {
* @throws DataException If the operation fails
*/
public Object getDataCtx(String key) throws DataException {
String result = cedarling.getDataCtx(key);
JsonValue result = cedarling.getDataCtx(key);
if (result == null) {
return null;
}
try {
org.json.JSONTokener tokener = new org.json.JSONTokener(result);
org.json.JSONTokener tokener = new org.json.JSONTokener(result.getValue());
Object value = tokener.nextValue();
if (value == org.json.JSONObject.NULL) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import uniffi.cedarling_uniffi.AuthorizeException;
import uniffi.cedarling_uniffi.BatchAuthorizeMultiIssuerResponse;
import uniffi.cedarling_uniffi.BatchItem;
import uniffi.cedarling_uniffi.JsonValue;
import uniffi.cedarling_uniffi.BatchItemError;
import uniffi.cedarling_uniffi.BatchItemMultiIssuerOutcome;
import uniffi.cedarling_uniffi.EntityData;
Expand Down Expand Up @@ -201,7 +202,8 @@ public void batchMixedDecisionsPreserveOrder() throws Exception {
BatchItem badItem = new BatchItem(
EntityData.Companion.fromJson(resource.toString()),
"this is not a valid uid",
new JSONObject().toString());
new JsonValue("{}")
);
List<BatchItem> items = new ArrayList<>();
items.add(sameItem());
items.add(badItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import uniffi.cedarling_uniffi.AuthorizeResult;
import uniffi.cedarling_uniffi.BatchAuthorizeUnsignedResponse;
import uniffi.cedarling_uniffi.BatchItem;
import uniffi.cedarling_uniffi.JsonValue;
import uniffi.cedarling_uniffi.BatchItemError;
import uniffi.cedarling_uniffi.BatchItemUnsignedOutcome;
import uniffi.cedarling_uniffi.EntityData;
Expand Down Expand Up @@ -155,7 +156,7 @@ public void batchMixedDecisionsPreserveOrder() throws Exception {
items.add(new BatchItem(
EntityData.Companion.fromJson(resource.toString()),
"this is not a valid uid",
context.toString()));
new JsonValue(context.toString())));
items.add(sameItem());

BatchAuthorizeUnsignedResponse response =
Expand Down
4 changes: 2 additions & 2 deletions jans-cedarling/bindings/cedarling_uniffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ name = "cedarling_uniffi"
# dependency for NOT wasm target
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
cedarling = { workspace = true, features = ["blocking"] }
uniffi = { version = "0.29.0", features = ["cli"] }
uniffi_macros = "0.29.0" # Procedural macros support
uniffi = { version = "0.32.0", features = ["cli"] }
uniffi_macros = "0.32.0" # Procedural macros support
serde_json = { workspace = true }
thiserror.workspace = true

Expand Down
Loading
Loading