1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Subject currentUser = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(username, password); token.setRememberMe(true); try { currentUser.login(token); } catch (UnknownAccountException e) { logger.error(String.format("user not found: %s", username), e); } catch (IncorrectCredentialsException e) { logger.error(String.format("incorrent credentials: %s", username), e); } catch (ConcurrentAccessException e) { logger.error(String.format("user has been authenticated: %s", username), e); } catch (AccountException e) { logger.error(String.format("account except: %s", username), e); }
|