Skip to content

Commit

Permalink
Add more logging to the auth operations on failure (apache#7567)
Browse files Browse the repository at this point in the history
* Added upgrade notes

* Add more logs on failure of auth operations

Co-authored-by: Sanjeev Kulkarni <[email protected]>
  • Loading branch information
srkukarni and Sanjeev Kulkarni authored Jul 17, 2020
1 parent d2b866b commit 2a0cb69
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ default CompletableFuture<Boolean> allowNamespaceOperationAsync(NamespaceName na
String role, NamespaceOperation operation,
AuthenticationDataSource authData) {
return FutureUtil.failedFuture(
new IllegalStateException("NamespaceOperation is not supported by the Authorization provider you are using."));
new IllegalStateException(
String.format("NamespaceOperation(%s) on namespace(%s) by role(%s) is not supported" +
" by the Authorization provider you are using.",
operation.toString(), namespaceName.toString(), role == null ? "null" : role)));
}

default Boolean allowNamespaceOperation(NamespaceName namespaceName, String originalRole, String role,
Expand All @@ -285,7 +288,10 @@ default CompletableFuture<Boolean> allowNamespacePolicyOperationAsync(NamespaceN
PolicyOperation operation, String originalRole,
String role, AuthenticationDataSource authData) {
return FutureUtil.failedFuture(
new IllegalStateException("NamespacePolicyOperation is not supported by the Authorization provider you are using."));
new IllegalStateException(
String.format("NamespacePolicyOperation(%s) on namespace(%s) by role(%s) is not supported" +
" by the Authorization provider you are using.", operation.toString(),
namespaceName.toString(), role == null ? "null" : role)));
}

default Boolean allowNamespacePolicyOperation(NamespaceName namespaceName, PolicyName policy, PolicyOperation operation,
Expand Down Expand Up @@ -313,7 +319,10 @@ default CompletableFuture<Boolean> allowTopicOperationAsync(TopicName topic, Str
TopicOperation operation,
AuthenticationDataSource authData) {
return FutureUtil.failedFuture(
new IllegalStateException("TopicOperation is not supported by the Authorization provider you are using."));
new IllegalStateException(
String.format("TopicOperation(%s) on topic(%s) by role(%s) is not supported" +
" by the Authorization provider you are using.",
operation.toString(), topic.toString(), role == null ? "null" : null)));
}

default Boolean allowTopicOperation(TopicName topicName, String originalRole, String role, TopicOperation operation,
Expand Down

0 comments on commit 2a0cb69

Please sign in to comment.