anchor.diff:      ExtAuthUid = value_or_null({<<"external_authentication_uid">>}, UserData),
       EnableRecovery = ej:get({"<<recovery_authentication_enabled>>"}, UserData) =:= true,
       {PublicKey, PubkeyVersion} = chef_object_base:cert_or_key(UserData),
  -    SerializedObject = { whitelisted_values(UserData) },
  +    SerializedObject = { whitelisted_values(UserData, ?JSON_SERIALIZABLE) },
       #chef_user{id = Id,
                  authz_id = chef_object_base:maybe_stub_authz_id(AuthzId, Id),
                  username = Name,
  
positive.code:         {{opt,<<"middle_name">>}, string},  %% FIXME these should be retained by the components that need them
          {{opt,<<"twitter_account">>}, string},
          {{opt,<<"city">>}, string},
          {{opt,<<"country">>}, string}
      ]};
  user_spec(create) ->
     {[ {<<"password">>, password_validator()} ]};
  user_spec(update) ->
      {[ {{opt,<<"password">>},  password_validator()},
         {{opt,<<"private_key">>}, boolean } ]}.
  
  %% Whitelist of fields we will persist to serialized_objects.  Fields not in this list and not part of the
  %% schema will cause updates to be rejected.
  -define(JSON_SERIALIZABLE, [<<"display_name">>,
                              <<"first_name">>,
                              <<"last_name">>,
                              <<"middle_name">>,
                              <<"city">>,
                              <<"country">>,
                              <<"twitter_account">>]).
  
  
  valid_email(EMail) when is_binary(EMail) ->
      valid_email(binary_to_list(EMail));
  
negative.code: valid_password(_Password) ->
      error.
  
  %% Returns the subset of permitted fields that are present in in the request.
  whitelisted_values(EJ, Permitted) ->
      [{X, ej:get({X}, EJ) } || X <- Permitted, ej:get({X}, EJ)  =/= undefined ].
  
  assemble_user_ejson(#chef_user{username = Name,
                                 public_key = KeyOrCert,
                                 email = Email,
                                 serialized_object = SerializedObject},
                      _OrgId) ->
      EJ = chef_json:decode(SerializedObject ),
      % public_key can mean either public key or cert.
      % if it's a cert, we need to extract the public key -
      % we don't want to hand the cert back on user GET.
  