1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2010 OpenStack LLC.
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
# not use this file except in compliance with the License. You may obtain
8
# a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
# License for the specific language governing permissions and limitations
20
from keystone.common import wsgi
21
import keystone.backends as db
22
from keystone.controllers.auth import AuthController
23
from keystone.controllers.tenant import TenantController
24
from keystone.controllers.version import VersionController
25
from keystone.controllers.staticfiles import StaticFilesController
26
from keystone.controllers.extensions import ExtensionsController
29
class ServiceApi(wsgi.Router):
30
"""WSGI entry point for Keystone Service API requests."""
32
def __init__(self, options):
33
self.options = options
34
mapper = routes.Mapper()
36
db.configure_backends(options)
39
auth_controller = AuthController(options)
40
mapper.connect("/tokens", controller=auth_controller,
41
action="authenticate",
42
conditions=dict(method=["POST"]))
43
mapper.connect("/ec2tokens", controller=auth_controller,
44
action="authenticate_ec2",
45
conditions=dict(method=["POST"]))
46
tenant_controller = TenantController(options)
47
mapper.connect("/tenants",
48
controller=tenant_controller,
50
conditions=dict(method=["GET"]))
52
# Miscellaneous Operations
53
version_controller = VersionController(options)
55
controller=version_controller,
56
action="get_version_info", file="service/version",
57
conditions=dict(method=["GET"]))
59
extensions_controller = ExtensionsController(options)
60
mapper.connect("/extensions",
61
controller=extensions_controller,
62
action="get_extensions_info",
63
path="content/service/extensions",
64
conditions=dict(method=["GET"]))
66
# Static Files Controller
67
static_files_controller = StaticFilesController(options)
68
mapper.connect("/identitydevguide.pdf",
69
controller=static_files_controller,
70
action="get_pdf_contract",
71
root="content/service/", pdf="identitydevguide.pdf",
72
conditions=dict(method=["GET"]))
73
mapper.connect("/identity.wadl",
74
controller=static_files_controller,
75
action="get_wadl_contract",
76
root="content/service/", wadl="identity.wadl",
77
conditions=dict(method=["GET"]))
78
mapper.connect("/common.ent",
79
controller=static_files_controller,
80
action="get_wadl_contract",
81
wadl="common.ent", root="content/common/",
82
conditions=dict(method=["GET"]))
83
mapper.connect("/xslt/{file:.*}",
84
controller=static_files_controller,
85
action="get_static_file", path="common/xslt/",
86
mimetype="application/xml",
87
conditions=dict(method=["GET"]))
88
mapper.connect("/style/{file:.*}",
89
controller=static_files_controller,
90
action="get_static_file", path="common/style/",
91
mimetype="application/css",
92
conditions=dict(method=["GET"]))
93
mapper.connect("/js/{file:.*}",
94
controller=static_files_controller,
95
action="get_static_file", path="common/js/",
96
mimetype="application/javascript",
97
conditions=dict(method=["GET"]))
98
mapper.connect("/samples/{file:.*}",
99
controller=static_files_controller,
100
action="get_static_file", path="common/samples/",
101
conditions=dict(method=["GET"]))
102
mapper.connect("/xsd/{xsd:.*}",
103
controller=static_files_controller,
104
action="get_xsd_contract", root="content/service/",
105
conditions=dict(method=["GET"]))
106
mapper.connect("/xsd/atom/{xsd}",
107
controller=static_files_controller,
108
action="get_xsd_atom_contract",
109
root="content/service/",
110
conditions=dict(method=["GET"]))
111
mapper.connect("/xsd/atom/{xsd}",
112
controller=static_files_controller,
113
action="get_xsd_atom_contract",
114
root="content/service/",
115
conditions=dict(method=["GET"]))
117
super(ServiceApi, self).__init__(mapper)