Skip to content

Commit

Permalink
Remove fixed server type check in kerberos client (apache#4758)
Browse files Browse the repository at this point in the history
## Motivation 

Currently, In Pulsar Kerberos authentication, The server type part of pulsar node principle is hard coded as "broker" and "proxy". The expected principle for pulsar nodes would be like "broker/[email protected]" or "proxy/[email protected]". 

But some times, user may want to re-use existing principle like "u-service/[email protected]", to test and play around, then "u-service" will not match service type of "broker" or "proxy", and the authentication will be rejected.
This change is to remove the check of "broker" or "proxy" service type check.

## Modifaction

Remove the check of "broker" or "proxy" service type check.
  • Loading branch information
zymap authored and jiazhai committed Jul 19, 2019
1 parent bbac857 commit f5b20cd
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public class PulsarSaslClient {
public PulsarSaslClient(String serverHostname, String serverType, Subject subject) throws SaslException {
checkArgument(subject != null, "Cannot create SASL client with NULL JAAS subject");
checkArgument(!Strings.isNullOrEmpty(serverHostname), "Cannot create SASL client with NUll server name");
checkArgument(serverType.equalsIgnoreCase(SaslConstants.SASL_BROKER_PROTOCOL) ||
serverType.equalsIgnoreCase(SaslConstants.SASL_PROXY_PROTOCOL),
"Server type [" + serverType + "] invalid, should be broker or proxy");
if (!serverType.equals(SaslConstants.SASL_BROKER_PROTOCOL) && !serverType
.equals(SaslConstants.SASL_PROXY_PROTOCOL)) {
log.warn("The server type {} is not recommended", serverType);
}

String serverPrincipal = serverType.toLowerCase() + "/" + serverHostname;
this.clientSubject = subject;
Expand Down

0 comments on commit f5b20cd

Please sign in to comment.