paascloud/paascloud-master · error · UacBizException

UAC10011002

UAC10011002

Error message

ErrorCodeEnum.UAC10011002

What it means

UacBizException with code UAC10011002 ('用户密码认证失败' / user password authentication failed) thrown by checkUserIsCorrect when findByLoginNameAndLoginPwd returns no user for the given loginName+loginPwd pair. Either the login name does not exist or the password is wrong; the message includes the attempted login name.

Solutions

  1. Confirm the login name exists (findByLoginName) before password verification to distinguish wrong-user from wrong-password.
  2. Verify the password encryption algorithm and salt match those used at registration (e.g., MD5/SHA settings in the security config).
  3. Trim/normalize loginName and check case sensitivity handling before the lookup.
  4. If the user forgot the password, direct them through the password-reset flow.

Example fix

// before
uacUserService.checkUserIsCorrect(loginReqDto);
// after
UacUser user = uacUserService.findByLoginName(loginReqDto.getLoginName());
if (user == null) {
    throw new UacBizException(ErrorCodeEnum.UAC10011003, loginReqDto.getLoginName());
}
uacUserService.checkUserIsCorrect(loginReqDto);
Defensive patterns

Strategy: try-catch

Validate before calling

if (loginReqDto == null || PublicUtil.isBlank(loginReqDto.getLoginName()) || PublicUtil.isBlank(loginReqDto.getLoginPwd())) { throw new IllegalArgumentException("loginName/loginPwd required"); }

Type guard

boolean credentialsPresent = loginReqDto != null && loginReqDto.getLoginName() != null && loginReqDto.getLoginPwd() != null;

Try / catch

try {
    uacUserService.checkUserIsCorrect(loginReqDto);
} catch (UacBizException e) {
    if ("UAC10011002".equals(e.getCode())) { throw new BadCredentialsException("用户名或密码错误"); }
    throw e;
}

Prevention

When it happens

Trigger: Calling checkUserIsCorrect(loginReqDto) with credentials that do not match any stored user — wrong password, non-existent login name, or password encrypted with a different algorithm/salt than the stored value.

Common situations: Users mistyping credentials at login; password encoder configuration changed so hashes no longer match; environment seeded with different user data than the client expects; login name case/whitespace differences.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/012e0db0de17bdd4. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java:127

	@Override
	public UacUser findByMobileNo(String mobileNo) {
		return uacUserMapper.findByMobileNo(mobileNo);
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public void checkUserIsCorrect(LoginReqDto loginReqDto) {
		logger.info("用户【" + loginReqDto.getLoginName() + "】进行密码认证......");

		Map<String, String> loginNamePwdMap = Maps.newHashMap();
		loginNamePwdMap.put("loginName", loginReqDto.getLoginName());
		loginNamePwdMap.put("loginPwd", loginReqDto.getLoginPwd());

		UacUser uacUser = uacUserMapper.findByLoginNameAndLoginPwd(loginNamePwdMap);
		if (PublicUtil.isEmpty(uacUser)) {
			logger.info("用户【" + loginReqDto.getLoginName() + "】密码认证失败");
			throw new UacBizException(ErrorCodeEnum.UAC10011002, loginReqDto.getLoginName());
		}

		logger.info("用户【" + loginReqDto.getLoginName() + "】密码认证成功");
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<Perm> getAllPerms() {
		logger.info("获取全部的权限...");
		return uacActionMapper.findAllPerms();
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<String> getUserPerms(Long userId) {
		logger.info("获取用户权限列表userId={}", userId);

		//1.获取所有菜单权限

View on GitHub (pinned to 781281a950)