Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][broker] Unreasonable AuthenticationException reference #18502

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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