Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthorizationError issues - No public accessors and lacking of toString #257

Open
3 tasks done
marisadiaz10 opened this issue Nov 15, 2024 · 1 comment
Open
3 tasks done
Labels
bug Something isn't working

Comments

@marisadiaz10
Copy link

marisadiaz10 commented Nov 15, 2024

Before opening, please confirm:

Bug Category

Other

Describe the bug

Hello team, would appreciate the help in the following issues

Version: 4.2.2

  1. Add public getters to AuthorizationError
    AuthorizationSuccessResponse.getErrors() exposes AuthorizationError, but it lacks public accessors.
    Could you please provide some getters so we can access AuthorizationError fields? We use them for logging/debugging and mapping the errors to internal representations.
    Note: getErrors() returned strings in the 3.x versions and we used them for logging, so this represents a regression given that we are losing debugability without the accessors in the newest version.

  2. Override toString in AuthorizationError
    AuthorizationSuccessResponse.toString() references diagnostics.errors, but given that AuthorizationError doesn't override toString, it returns the memory reference instead of the string representation.

Expected behavior

  1. Being able to access policyId and error within AuthorizationError
  2. Return String representation of diagnostics.errors

Reproduction steps

  1. Tried to access fields within any AuthorizationError instance
  2. Example code and string resulted:
final Diagnostics diagnostics = new Diagnostics(new HashSet<>(reasons), List.of(new AuthorizationError("policy", new DetailedError("message", Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()))));
final AuthorizationSuccessResponse authorizationSuccessResponse = new AuthorizationSuccessResponse(decision, diagnostics);
final String authString = authorizationSuccessResponse.toString();
image

Code Snippet

// Put your code below this line.

Log output

// Put your output below this line

Additional configuration

No response

Operating System

MacOS

Additional information and screenshots

No response

@marisadiaz10 marisadiaz10 added bug Something isn't working pending-triage Hasn't been triaged yet labels Nov 15, 2024
@john-h-kastner-aws
Copy link
Contributor

john-h-kastner-aws commented Nov 18, 2024

Hi thanks for opening this, we agree that these functions should be added. This looks like an oversight when moving from strings to more structured error types. While not strictly a "bug" I'll leave this tagged as such since it is a regression in capability from 3.x, and we want to fix this quickly

@john-h-kastner-aws john-h-kastner-aws removed the pending-triage Hasn't been triaged yet label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants