~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/oauth/model.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-09 04:02:31 UTC
  • mfrom: (14452.3.5 oauthpocalypse)
  • Revision ID: launchpad@pqm.canonical.com-20111209040231-87rrs6957y4jukaj
[r=wgrant][no-qa] Move OAuth code and tests from various places in
        canonical.launchpad to lp.services.oauth.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    datetime,
15
15
    timedelta,
16
16
    )
17
 
 
18
17
import re
 
18
 
19
19
import pytz
20
20
from sqlobject import (
21
21
    BoolCol,
23
23
    StringCol,
24
24
    )
25
25
from storm.expr import And
26
 
from storm.locals import Int, Reference
 
26
from storm.locals import (
 
27
    Int,
 
28
    Reference,
 
29
    )
27
30
from zope.component import getUtility
28
31
from zope.interface import implements
29
32
 
35
38
    create_token,
36
39
    create_unique_token_for_table,
37
40
    )
38
 
from canonical.launchpad.interfaces.oauth import (
39
 
    ClockSkew,
40
 
    IOAuthAccessToken,
41
 
    IOAuthConsumer,
42
 
    IOAuthConsumerSet,
43
 
    IOAuthNonce,
44
 
    IOAuthRequestToken,
45
 
    IOAuthRequestTokenSet,
46
 
    NonceAlreadyUsed,
47
 
    TimestampOrderingError,
48
 
    )
49
41
from canonical.launchpad.webapp.interfaces import (
50
42
    AccessLevel,
51
43
    IStoreSelector,
60
52
from lp.registry.interfaces.product import IProduct
61
53
from lp.registry.interfaces.projectgroup import IProjectGroup
62
54
from lp.services.database.stormbase import StormBase
 
55
from lp.services.oauth.interfaces import (
 
56
    ClockSkew,
 
57
    IOAuthAccessToken,
 
58
    IOAuthConsumer,
 
59
    IOAuthConsumerSet,
 
60
    IOAuthNonce,
 
61
    IOAuthRequestToken,
 
62
    IOAuthRequestTokenSet,
 
63
    NonceAlreadyUsed,
 
64
    TimestampOrderingError,
 
65
    )
63
66
 
64
67
# How many hours should a request token be valid for?
65
68
REQUEST_TOKEN_VALIDITY = 2