get or create lpuser via api

Bug #598464 reported by Michael Nelson
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Michael Nelson

Bug Description

For the buy-something blueprint,

https://blueprints.edge.launchpad.net/ubuntu/+spec/foundations-maverick-buy-something

we will need a way for the software center agent to provide Launchpad with an SSO openID identity and be returned with a launchpad user (creating the lp user if that user doesn't yet have an account). Perhaps something like:

people.getOrCreateFromIdentity(identity, rationale)

Its use should be restricted to a celebrity (in this case, software-center-agent).

Related branches

Curtis Hovey (sinzui)
affects: launchpad-registry → launchpad-foundations
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is about creating a user for authentication, I think the foundations team needs to give this consideration. PersonSet should not be creating an Account, and I understand the Lp-foundations teams want to remove the table. This mechanism appears to by bypassing the email confirmation steps to ensure the user is legitimate.

Given that we are attacked by spammers every day, and one has proven to be partiulary adept at exploiting SSO and Launchpad to create identities, I think this feature are described is bad.

Revision history for this message
Michael Nelson (michael.nelson) wrote :

Hi Curtis,

The account should be created only if the identifier is valid (which can be checked via SSO) - that is, the user must already have an SSO account.

Revision history for this message
Gary Poster (gary) wrote :

Michael's constraint (the user must already have an SSO account) sounds fine to me.

Changed in launchpad-foundations:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Michael Nelson (michael.nelson)
Revision history for this message
Gary Poster (gary) wrote :

I talked about this with Francis last week. While I don't see a new spammer weakness with what Michael suggested, my opinion on the proposed (implemented?) solution is mixed for another reason.

AIUI, this is temporary, because we don't want to have to create LP users for software center purchasers in the future.

This is also a private API: only one celebrity should use it. We don't really even want to advertise it.

Because of this, I'm inclined to prefer using our private XMLRPC server, protected by IP address.

Francis' counterargument is "why have more than one way to expose APIs?"

That's a good question. However, I regard the REST webservice as a public resource. Because this is temporary *and* private, my gut wants this to not be around in the webservice.

That said, if we do already have an implementation of the webservice approach, I'll just quietly go along with it.

Revision history for this message
Ursula Junque (ursinha) wrote : Bug fixed by a commit
Changed in launchpad-foundations:
milestone: none → 10.08
tags: added: qa-needstesting
Changed in launchpad-foundations:
status: Triaged → Fix Committed
Revision history for this message
Michael Nelson (michael.nelson) wrote :

Marking this as qa-bad - I've created a new user on login.staging.launchpad.net and then tried to access Launchpad (ie. there will not yet be an LP account), but it results in:

https://lp-oops.canonical.com/oops.py/?oopsid=1663S295

tags: added: qa-bad
removed: qa-needstesting
Revision history for this message
Michael Nelson (michael.nelson) wrote :

If I apply: http://pastebin.ubuntu.com/467028/ and then run:

$ bin/test -vv -m test_personset -t test_no_account_or_email

I can force a similar error:

{{{
  File "/home/michael/launchpad/lp-branches/598464-qa-fix/lib/lp/registry/model/person.py", line 2505, in getOrCreateByOpenID
Identifier
    return IPerson(account), db_updated
TypeError: ('Could not adapt', <Account 'Joe Bloggs' (Active account)>, <InterfaceClass lp.registry.interfaces.person.IPerson>)
}}}

But I'm not certain that the cause is correct. I can't see how it could be that the person doesn't exist when the adaption takes place, as it's all within a MasterStorePolicy block. I'll wait to hear from Gary (or someone with more insight), but if this is the case, then this would fix it: http://pastebin.ubuntu.com/467034/

Revision history for this message
Michael Nelson (michael.nelson) wrote :

The QA fix for this landed a few days ago on devel (r11209) which was merged into db-devel (r9570), but still waiting for staging to be updated to include this revision (r9565 at time of writing).

To QA:

1) Visit login.staging.launchpad.net and create a new account there (ie. an SSO only account)
2) After completing the verification and being logged in, visit staging.launchpad.net and ensure the oops is not triggered.

Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-bad
Revision history for this message
Michael Nelson (michael.nelson) wrote :

QA'd the fix for the qa-bad using steps on comment 8 above.

I then QA'd the actual xmlrpc call as follows:

https://pastebin.canonical.com/35620/

tags: added: qa-ok
removed: qa-needstesting
Changed in launchpad-foundations:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.