Package com.jeecms.common.security.userdetails

Source Code of com.jeecms.common.security.userdetails.AccountStatusUserDetailsChecker

package com.jeecms.common.security.userdetails;

import com.jeecms.common.security.AccountExpiredException;
import com.jeecms.common.security.AccountStatusException;
import com.jeecms.common.security.CredentialsExpiredException;
import com.jeecms.common.security.DisabledException;
import com.jeecms.common.security.LockedException;

/**
* @author Luke Taylor
* @version $Id: AccountStatusUserDetailsChecker.java 3558 2009-04-15 07:39:21Z
*          ltaylor $
*/
public class AccountStatusUserDetailsChecker implements UserDetailsChecker {
  public void check(UserDetails user) throws AccountStatusException {
    if (!user.isAccountNonLocked()) {
      throw new LockedException();
    }

    if (!user.isEnabled()) {
      throw new DisabledException("User is disabled", user);
    }

    if (!user.isAccountNonExpired()) {
      throw new AccountExpiredException("User account has expired", user);
    }

    if (!user.isCredentialsNonExpired()) {
      throw new CredentialsExpiredException(
          "User credentials have expired", user);
    }
  }
}
TOP

Related Classes of com.jeecms.common.security.userdetails.AccountStatusUserDetailsChecker

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.