public UserDetails getUserByApiKey(String apiKey) {
    UserDetails userDetails = userSecurityRepository.getUserByApiKey(apiKey);
    if (userDetails == null) {
      throw new UserNotFoundException("User could not be found with the supplied api key.");
    }

    return userDetails;
  }
  public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
    UserDetails userDetails = userSecurityRepository.getUserByUsername(s);
    if (userDetails == null) {
      throw new UsernameNotFoundException("User not found using supplied username");
    }

    return userDetails;
  }