Skip to content

feat(tpe): add type-aware partial authorization request and response - #371

Merged
muditchaudhary merged 1 commit into
cedar-policy:mainfrom
muditchaudhary:tpe-request-response
Sep 25, 2026
Merged

muditchaudhary merged 1 commit into
cedar-policy:mainfrom
muditchaudhary:tpe-request-response

Conversation

@muditchaudhary

@muditchaudhary muditchaudhary commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the request and response types for Cedar's type-aware partial evaluation (TPE), plus the FFI validator behind them. This is the other half of the foundation — #370 added the entity model. Everything is @Experimental and purely additive; no existing API changes.

The authorization call itself still doesn't exist. That's the next PR, which adds the Rust handler and the AuthorizationEngine methods.

What

CedarJava

  • TypeAwarePartialAuthorizationRequest — the principal and resource may have an unknown id, their types are always known, and the action must be concrete. Its builder type checks against the schema at build time, so a request in hand has been checked. Overloads accept a concrete EntityUID, a PartialEntityUID, or just an EntityTypeName for the unknown-id case.
  • TypeAwarePartialAuthorizationResponse — the success/failure envelope, mirroring Partial Evaluation's shape.
  • TypeAwarePartialAuthorizationSuccessResponse — the decision, every residual, the trivial and non-trivial partitions as JSON, and getPolicySet() for reauthorization.

CedarJavaFFI

  • validate_type_aware_partial_request, which builds a PartialRequest and discards it — the same validate-and-discard pattern as the entity validators.

Notable decisions

Residual accessors are deliberately not named after Cedar's. . Instead getPolicySet() is every residual, and the trivial/non-trivial split is computed here from the nontrivialResiduals id set.

Issue: #364

@muditchaudhary
muditchaudhary force-pushed the tpe-request-response branch 2 times, most recently from ddaddab to d03cdd7 Compare September 23, 2026 18:40
@muditchaudhary
muditchaudhary marked this pull request as ready for review September 23, 2026 19:21
@muditchaudhary muditchaudhary changed the title feat(tpe): add type-aware partial authorization request and response … feat(tpe): add type-aware partial authorization request and response Sep 23, 2026
Comment thread CedarJavaFFI/src/tests.rs Outdated
use serde_json::json;

const SCHEMA: &str = r#"
pub(crate) const CEDAR_SRC: &str = r#"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Better, but I think my vote would be CEDAR_SCHEMA_SRC going in this direction

Comment thread CedarJavaFFI/src/tests.rs
}

/// The same schema in Cedar's JSON schema format, as a JSON object.
pub(crate) fn schema_json() -> String {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Nice, but I guess then if we ever update it, we'd have to update it in two places. Wonder if we should use a Cedar Rust Schema helper here to convert CEDAR_SRC directly instead.

…types

Completes the type-aware partial evaluation (TPE) surface on the Java
side. Step 1 added the entity model; this adds the request and response
types plus the FFI request validator. All new API is @experimental and
purely additive.

Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
@muditchaudhary
muditchaudhary merged commit dcf4d91 into cedar-policy:main Sep 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants