protected void updateUserProperties(User user) {
   if (user == null) {
     return;
   }
   if (user.getProperties() != null) {
     this.getModifiableUserProperties().putAll(user.getProperties());
   }
 }
 protected void logInWithPassword() throws AuthenticationException {
   if (StringUtils.isBlank(this.getUsername())) {
     throw new InvalidCredentialsException("Invalid username");
   }
   if (StringUtils.isBlank(this.getPassword())) {
     throw new InvalidCredentialsException("Invalid password");
   }
   logger.info("Logging in with username & password");
   AuthenticationRequest request =
       new AuthenticationRequest(this, this.getUsername(), this.getPassword());
   AuthenticationResponse response =
       this.getAuthenticationService()
           .makeRequest(routeAuthenticate, request, AuthenticationResponse.class);
   if (!response.getClientToken().equals(this.getAuthenticationService().getClientToken())) {
     throw new AuthenticationException(
         "Server requested we change our client token, Don't know how to handle this!");
   }
   if (response.getSelectedProfile() != null) {
     this.setUserType(
         response.getSelectedProfile().isLegacy() ? UserType.LEGACY : UserType.MOJANG);
   } else if (ArrayUtils.isNotEmpty(response.getAvailableProfiles())) {
     this.setUserType(
         response.getAvailableProfiles()[0].isLegacy() ? UserType.LEGACY : UserType.MOJANG);
   }
   User user = response.getUser();
   if (user != null && user.getId() != null) {
     this.setUserid(user.getId());
   } else {
     this.setUserid(this.getUsername());
   }
   this.isOnline = true;
   this.accessToken = response.getAccessToken();
   this.profiles = response.getAvailableProfiles();
   this.setSelectedProfile(response.getSelectedProfile());
   this.getModifiableUserProperties().clear();
   this.updateUserProperties(user);
 }