Example usage for org.apache.shiro.authc ConcurrentAccessException ConcurrentAccessException

List of usage examples for org.apache.shiro.authc ConcurrentAccessException ConcurrentAccessException

Introduction

In this page you can find the example usage for org.apache.shiro.authc ConcurrentAccessException ConcurrentAccessException.

Prototype

public ConcurrentAccessException() 

Source Link

Document

Creates a new ConcurrentAccessException.

Usage

From source file:com.gamewin.weixin.service.account.ShiroDbRealm.java

License:Apache License

/**
 * ?,./*from   ww  w .  ja v  a2 s . c  om*/
 */
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken)
        throws AuthenticationException {
    UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
    User user = accountService.findUserByLoginName(token.getUsername());
    if (user != null) {
        if ("disabled".equals(user.getStatus())) {
            throw new DisabledAccountException();
        } else if ("Audit".equals(user.getStatus())) {
            throw new ConcurrentAccessException();
        }
        byte[] salt = Encodes.decodeHex(user.getSalt());
        return new SimpleAuthenticationInfo(
                new ShiroUser(user.getId(), user.getLoginName(), user.getName(), user.getRoles()),
                user.getPassword(), ByteSource.Util.bytes(salt), getName());
    } else {
        return null;
    }
}