]> git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/__init__.py
Remove old boilerplate authn and authz.
[xonotic/xonstat.git] / xonstat / __init__.py
index ff783f9da855369079d2e6e1b09652338127b407..d0c033fa7f3f829148312a1bcd83805df44f361f 100644 (file)
@@ -1,7 +1,5 @@
 import sqlahelper
 from pyramid_beaker import set_cache_regions_from_settings
-from pyramid.authentication import AuthTktAuthenticationPolicy
-from pyramid.authorization import ACLAuthorizationPolicy
 from pyramid.config import Configurator
 from pyramid.httpexceptions import HTTPNotFound
 from pyramid.renderers import JSONP
@@ -34,12 +32,6 @@ def main(global_config, **settings):
     # for json-encoded responses
     config.add_renderer('jsonp', JSONP(param_name='callback'))
 
-    # authentication and authorization policies
-    authn_policy = AuthTktAuthenticationPolicy('secret', hashalg='sha512')
-    authz_policy = ACLAuthorizationPolicy()
-    config.set_authentication_policy(authn_policy)
-    config.set_authorization_policy(authz_policy)
-
     # for static assets
     config.add_static_view('static', 'xonstat:static')
 
@@ -171,7 +163,10 @@ def main(global_config, **settings):
     # ADMIN ROUTES
     config.add_forbidden_view(forbidden, renderer="forbidden.mako")
 
+    config.add_route("login", "/login")
+    config.add_view(login, route_name="login", check_csrf=True, renderer="json")
+
     config.add_route("merge",      "/merge")
-    config.add_view(route_name="merge", renderer="merge.mako", permission="admin")
+    config.add_view(route_name="merge", renderer="merge.mako", permission="merge")
 
     return config.make_wsgi_app()