Code review comment for lp:~mardy/ubuntuone-credentials/default-token-name

Revision history for this message
Alberto Mardegan (mardy) wrote :

> After looking at this and the plugin-part1 branch again, I think the better
> solution here would be to get rid of the ValidateInput method completely here,
> and we should call buildTokenName() in the createToken() method where we
> assemble the JSON to POST to the server, instead of using m_data.TokenName()
> there. This value should also be set on the token and stored, rather than
> setting the value on the Token object after it had been stored. Then we should
> just read the value from the stored Token when one already exists.

But then we lose the possibility for applications to specify their own token name: every app running on the device will be using the same token name. Given that the server allows for different apps to specify a token name, I think we should preserve this possibility.

> It seems to me that would simplify the code a bit, and be aligned with the
> current behavior, which this change (and the current plugin-part1 code) is
> not.

I think that this change maintains the behaviour which we currently have, and it allows for a third party app to use a different token name.

In case it's not clear, the code in part1 causes the plugin to store the tokens as a dictionary:

  token-name-1: { token data 1 },
  token-name-2: { token data 2 },
  ...

« Back to merge proposal