Skip to content

Comments

Resolves #257#294

Merged
muditchaudhary merged 2 commits intocedar-policy:mainfrom
muditchaudhary:fixIssue257
Feb 14, 2025
Merged

Resolves #257#294
muditchaudhary merged 2 commits intocedar-policy:mainfrom
muditchaudhary:fixIssue257

Conversation

@muditchaudhary
Copy link
Contributor

Resolves #257

Description of changes:

  1. Creates public getter methods for AuthorizationError
  2. Overrides .toString() for AuthorizationError, DetailedError, and SourceLabel.

Example:

Set<String> reasons = new HashSet<>();
reasons.add("p1");

List<SourceLabel> sourceLabel = List.of(new SourceLabel(Optional.of("sourceLabel"), 0, 10));

final Diagnostics diagnostics = new Diagnostics(new HashSet<>(reasons),
        List.of(new AuthorizationError("policyError1",
                new DetailedError("message", Optional.of("dummyHelp"), 
                Optional.of("dummyCode"),
                Optional.of("dummyUrl"), 
                Optional.of(Severity.Error), 
                Optional.of(sourceLabel),
                Optional.empty()))));

final AuthorizationSuccessResponse authorizationSuccessResponse = new AuthorizationSuccessResponse(
        Decision.Deny, diagnostics);
        
System.out.println(authorizationSuccessResponse)

Output

Deny, reason [p1], 
errors [AuthorizationError{policyId=policyError1, error=DetailedError{message="message", help="dummyHelp", code="dummyCode", url="dummyUrl", severity=Error, sourcelocations=[SourceLabel{label="sourceLabel", start=0, end=10}], related=[]}}

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 February 12, 2025 21:38
@muditchaudhary muditchaudhary merged commit 3421046 into cedar-policy:main Feb 14, 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.

AuthorizationError issues - No public accessors and lacking of toString

3 participants