Skip to content

Comments

Creates Backward Compatible Context Class#286

Merged
muditchaudhary merged 15 commits intocedar-policy:mainfrom
muditchaudhary:createContext
Feb 12, 2025
Merged

Creates Backward Compatible Context Class#286
muditchaudhary merged 15 commits intocedar-policy:mainfrom
muditchaudhary:createContext

Conversation

@muditchaudhary
Copy link
Contributor

@muditchaudhary muditchaudhary commented Jan 29, 2025

Description

  1. Currently, CedarJava handles Context as Map<String,Value> without a dedicated class. This PR creates Java equivalent class for Context.
  2. Implements methods to create and merge Contexts within CedarJava. Currently, does not implement from_* methods.
  3. Uses method overloading to make it backward compatible in authorization requests.
  4. Implements tests for Context.
  5. Implements tests to verify backward compatibility in AuthorizationRequest and PartialAuthorizationRequest.

Future Consideration:

  • Create .copy() for all classes that implement Value interface. This will allow us to create deep-copy of any object that use Value. Currently, we can only create shallow copies for objects such as Context. For example, .getContext() creates and returns a shallow copy of the Map<String, Value> context but the Value object can potentially be modified.

Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
…thorizationRequest

Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
@muditchaudhary muditchaudhary marked this pull request as ready for review January 29, 2025 00:57
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
@muditchaudhary muditchaudhary merged commit 6e1f655 into cedar-policy:main Feb 12, 2025
4 checks passed
jtbrain pushed a commit to jtbrain/cedar-java that referenced this pull request Feb 18, 2025
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
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