Skip to content

Commit

Permalink
[improve][broker] Unreasonable AuthenticationException reference (#18502
Browse files Browse the repository at this point in the history
)
  • Loading branch information
zzccctv authored Nov 18, 2022
1 parent e0606b4 commit e5e5852
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public AuthenticationService(ServiceConfiguration conf) throws PulsarServerExcep

public String authenticateHttpRequest(HttpServletRequest request, AuthenticationDataSource authData)
throws AuthenticationException {
AuthenticationException authenticationException = null;
String authMethodName = request.getHeader(AuthenticationFilter.PULSAR_AUTH_METHOD_NAME);

if (authMethodName != null) {
Expand All @@ -108,8 +107,6 @@ public String authenticateHttpRequest(HttpServletRequest request, Authentication
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 {
Expand All @@ -133,11 +130,7 @@ public String authenticateHttpRequest(HttpServletRequest request, Authentication
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>";
Expand Down

0 comments on commit e5e5852

Please sign in to comment.