~launchpad-pqm/launchpad/devel

402 by Canonical.com Patch Queue Manager
Merge librarian and authserver into launchpad
1
# Copyright 2004 Canonical Ltd.  All rights reserved.
1625 by Canonical.com Patch Queue Manager
Add saltless API to authserver
2
#
3
# This configuration creates an XML-RPC service listening on port 8999.  It
4
# exposes two APIs:
5
#   - the version 1 API with salts + SSHA digests, at /
6
#   - and the version 2 API with clear text passwords, at /v2/
7
#
8
# e.g. http://localhost:8999/v2/ is the path the version 2 API.
402 by Canonical.com Patch Queue Manager
Merge librarian and authserver into launchpad
9
10
from twisted.application import service, internet
1625 by Canonical.com Patch Queue Manager
Add saltless API to authserver
11
from twisted.web import server, resource
402 by Canonical.com Patch Queue Manager
Merge librarian and authserver into launchpad
12
from twisted.enterprise.adbapi import ConnectionPool
13
14
from canonical.authserver.xmlrpc import UserDetailsResource
15
from canonical.authserver.database import DatabaseUserDetailsStorage
1625 by Canonical.com Patch Queue Manager
Add saltless API to authserver
16
from canonical.authserver.xmlrpc import UserDetailsResourceV2
17
from canonical.authserver.database import DatabaseUserDetailsStorageV2
402 by Canonical.com Patch Queue Manager
Merge librarian and authserver into launchpad
18
19
20
application = service.Application("authserver_test")
21
dbpool = ConnectionPool('psycopg', 'dbname=launchpad_test')
22
storage = DatabaseUserDetailsStorage(dbpool)
1625 by Canonical.com Patch Queue Manager
Add saltless API to authserver
23
root = resource.Resource()
24
versionOneAPI = UserDetailsResource(DatabaseUserDetailsStorage(dbpool))
25
versionTwoAPI = UserDetailsResourceV2(DatabaseUserDetailsStorageV2(dbpool))
26
root.putChild('', versionOneAPI)
27
root.putChild('v2', versionTwoAPI)
1989 by Canonical.com Patch Queue Manager
MoinLaunchpadAuthentication. [r=stub,salgado]
28
site = server.Site(root)
402 by Canonical.com Patch Queue Manager
Merge librarian and authserver into launchpad
29
internet.TCPServer(8999, site).setServiceParent(application)
30