Skip to content

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

@marisadiaz10

Description

@marisadiaz10

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions