本文整理了Java中org.springframework.security.authentication.DisabledException.getMessage()
方法的一些代码示例,展示了DisabledException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DisabledException.getMessage()
方法的具体详情如下:
包路径:org.springframework.security.authentication.DisabledException
类名称:DisabledException
方法名:getMessage
暂无
代码示例来源:origin: zhangxd1989/springboot-dubbox
/**
* Handle business exception map.
*
* @param ex the ex
* @return the map
*/
@ExceptionHandler(DisabledException.class)
@ResponseStatus(HttpStatus.FORBIDDEN)
public Map<String, Object> handleBusinessException(DisabledException ex) {
//用户被停用
return makeErrorMessage(ReturnCode.DISABLED_USER, "User Disabled", ex.getMessage());
}
代码示例来源:origin: jtalks-org/jcommune
/**
* {@inheritDoc}
*/
@Override
public AuthenticationStatus authenticate(LoginUserDto loginUserDto, HttpServletRequest request,
HttpServletResponse response) throws UnexpectedErrorException, NoConnectionException {
AuthenticationStatus result;
JCUser user;
try {
user = getByUsername(loginUserDto.getUserName());
result = authenticateDefault(user, loginUserDto.getPassword(), loginUserDto.isRememberMe(), request, response);
} catch (NotFoundException e) {
LOGGER.info("User was not found during login process, username = {}, IP={}",
loginUserDto.getUserName(), loginUserDto.getClientIp());
result = authenticateByPluginAndUpdateUserInfo(loginUserDto, true, request, response);
} catch(DisabledException e) {
LOGGER.info("DisabledException: username = {}, IP={}, message={}",
new String[]{loginUserDto.getUserName(), loginUserDto.getClientIp(), e.getMessage()});
result = AuthenticationStatus.NOT_ENABLED;
} catch (AuthenticationException e) {
LOGGER.info("AuthenticationException: username = {}, IP={}, message={}",
new String[]{loginUserDto.getUserName(), loginUserDto.getClientIp(), e.getMessage()});
result = authenticateByPluginAndUpdateUserInfo(loginUserDto, false, request, response);
}
return result;
}
代码示例来源:origin: com.holon-platform.core/holon-spring-security
@Override
public Authentication authenticate(T authenticationToken) throws AuthenticationException {
if (authenticationToken == null) {
throw new InvalidTokenException("Null authentication token");
}
org.springframework.security.core.Authentication authentication = getAuthentication(authenticationToken);
if (authentication == null) {
throw new InvalidTokenException("Invalid authentication token: missing Spring Security Authentication");
}
try {
authentication = authenticationManager.authenticate(authentication);
} catch (UsernameNotFoundException e) {
throw new UnknownAccountException(e.getMessage());
} catch (BadCredentialsException e) {
throw new InvalidCredentialsException(e.getMessage());
} catch (CredentialsExpiredException | AccountExpiredException e) {
throw new ExpiredCredentialsException(e.getMessage());
} catch (DisabledException e) {
throw new DisabledAccountException(e.getMessage());
} catch (LockedException e) {
throw new LockedAccountException(e.getMessage());
} catch (Exception e) {
throw new UnexpectedAuthenticationException(e.getMessage(), e);
}
return SpringSecurityAuthentication.create(authentication);
}
内容来源于网络,如有侵权,请联系作者删除!