in domain/src/main/java/org/apache/rocketmq/eventbridge/domain/model/connection/ConnectionService.java [170:188]
private void checkBasicAuthParameters(AuthParameters authParameters) {
BasicAuthParameters basicAuthParameters = authParameters.getBasicAuthParameters();
if (AuthorizationTypeEnum.BASIC_AUTH.getType().equals(authParameters.getAuthorizationType()) && basicAuthParameters == null) {
throw new EventBridgeException(EventBridgeErrorCode.BasicRequiredParameterIsEmpty);
}
if (basicAuthParameters != null && AuthorizationTypeEnum.BASIC_AUTH.getType().equals(authParameters.getAuthorizationType())) {
if (StringUtils.isBlank(basicAuthParameters.getUsername()) || StringUtils.isBlank(basicAuthParameters.getPassword())) {
throw new EventBridgeException(EventBridgeErrorCode.BasicRequiredParameterIsEmpty);
}
String username = basicAuthParameters.getUsername();
String password = basicAuthParameters.getPassword();
if (username.length() > EventBridgeConstants.MAX_LENGTH_CONSTANT || username.length() < EventBridgeConstants.MIN_LENGTH_CONSTANT) {
throw new EventBridgeException(EventBridgeErrorCode.BasicUserNameLengthExceed);
}
if (password.length() > EventBridgeConstants.MAX_LENGTH_CONSTANT || password.length() < EventBridgeConstants.MIN_LENGTH_CONSTANT) {
throw new EventBridgeException(EventBridgeErrorCode.BasicPassWordLengthExceed);
}
}
}