List of usage examples for org.apache.shiro.authc AccountException AccountException
public AccountException()
From source file:cn.ligoo.part.service.shiro.CustomAuthorizingRealm.java
License:Apache License
/** * ?,./*from w w w . ja va2 s .c o m*/ */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException { logger.debug("...CustomAuthorizingRealm.doGetAuthenticationInfo()"); CustomToken token = (CustomToken) authcToken; String username = token.getUsername(); if (username == null) { throw new AccountException(); } UserInfo user = userInfoService.findByEmail(username); if (user == null) { throw new UnknownAccountException(); } if (user.getIs_del() == Constants.BYTE_1) { throw new DisabledAccountException(); } return new SimpleAuthenticationInfo(new ShiroUser(user.getId(), user.getEmail()), user.getPassword(), getName()); }
From source file:ssh.demo.service.shiro.CustomAuthorizingRealm.java
License:Apache License
/** * ?,.//from ww w.jav a2 s .co m */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException { logger.trace("----->CustomAuthorizingRealm.doGetAuthenticationInfo()"); CustomToken token = (CustomToken) authcToken; String username = token.getUsername(); if (username == null) { throw new AccountException(); } User user = userService.findByLoginName(username); if (user == null) { throw new UnknownAccountException(); } if (user.getState() == 1) { throw new DisabledAccountException(); } return new SimpleAuthenticationInfo(new ShiroUser(user.getId(), user.getEmail()), user.getPassword(), getName()); }