@Override
 public boolean isUserInRole(Principal principal, String role) {
   User user = (User) principal;
   _logger.debug("isUserInRole called with role[{}], user[{}]", role, user);
   if (USER_ROLE.ADMIN.toString().equalsIgnoreCase(user.getRole())) {
     return true;
   } else if (role.equalsIgnoreCase(user.getRole())) {
     return true;
   } else {
     _logger.info("Roles Mismatch, api role[{}], user role[{}]", role, user.getRole());
   }
   return false;
 }
 @Override
 public Principal authenticate(String aUsername, String aPassword) throws SecurityException {
   _logger.debug("User:{},Password:{}", aUsername, aPassword);
   User user = DaoUtils.getUserDao().get(aUsername);
   if (user != null) {
     _logger.debug("User Found...User:{}", user);
     if (user.getPassword().equals(aPassword)) {
       user.setPassword(null);
       return user;
     }
   }
   throw new SecurityException("Access denied to user " + aUsername);
 }
 public static boolean login(String aUsername, String aPassword) {
   if (aUsername == null || aPassword == null) {
     return false;
   }
   _logger.debug("User:{},Password:{}", aUsername, aPassword);
   User user = DaoUtils.getUserDao().get(aUsername);
   if (user != null) {
     _logger.debug("User Found...User:{}", user);
     if (user.getPassword().equals(aPassword)) {
       return true;
     }
   }
   return false;
 }