242526272829303132
if (!user.isAccountNonExpired()) { throw new AccountExpiredException("User account has expired", user); } if (!user.isCredentialsNonExpired()) { throw new CredentialsExpiredException( "User credentials have expired", user); } }