Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-1068

Simplify failing in the case of RBAC AuthorizationResult.Decision.DENY

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Optional Optional
    • 3.0.0.Alpha1
    • None
    • Management
    • None

      There's a fair amount of this kind of code in misc OSHs that directly ask the OperationContext to authorize something:

      AuthorizationResult authorizationResult = context.authorize(...);
      if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) {
          throw ControllerMessages.MESSAGES.unauthorized(operation.get(OP).asString(),
                                  context.getCurrentAddress()), authorizationResult.getExplanation());
      }
      

      We can replace that if block with a call to a new util method on AuthorizationResult itself:

      public void failIfDenied(ModelNode operation, PathAddress pathAddress) throws OperationFailedException
      

              bstansbe@redhat.com Brian Stansberry
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: