This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new e5e5852ee3e [improve][broker] Unreasonable AuthenticationException
reference (#18502)
e5e5852ee3e is described below
commit e5e5852ee3ed5ae661104784c82a1b8f0cda321d
Author: zzccctv <[email protected]>
AuthorDate: Fri Nov 18 11:42:52 2022 +0800
[improve][broker] Unreasonable AuthenticationException reference (#18502)
---
.../pulsar/broker/authentication/AuthenticationService.java | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git
a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java
b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java
index 0dedef64159..c63f5505e59 100644
---
a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java
+++
b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java
@@ -87,7 +87,6 @@ public class AuthenticationService implements Closeable {
public String authenticateHttpRequest(HttpServletRequest request,
AuthenticationDataSource authData)
throws AuthenticationException {
- AuthenticationException authenticationException = null;
String authMethodName =
request.getHeader(AuthenticationFilter.PULSAR_AUTH_METHOD_NAME);
if (authMethodName != null) {
@@ -108,8 +107,6 @@ public class AuthenticationService implements Closeable {
LOG.debug("Authentication failed for provider " +
providerToUse.getAuthMethodName() + " : "
+ e.getMessage(), e);
}
- // Store the exception so we can throw it later instead of a
generic one
- authenticationException = e;
throw e;
}
} else {
@@ -133,11 +130,7 @@ public class AuthenticationService implements Closeable {
return anonymousUserRole;
}
// If at least a provider was configured, then the authentication
needs to be provider
- if (authenticationException != null) {
- throw authenticationException;
- } else {
- throw new AuthenticationException("Authentication required");
- }
+ throw new AuthenticationException("Authentication required");
} else {
// No authentication required
return "<none>";