Skip to content
Snippets Groups Projects
authRouteDescriptor.py 1.46 KiB
Newer Older
#!/usr/bin/env python

#
# Auth route descriptor.
#

from dm.common.utility.configurationManager import ConfigurationManager
from authSessionController import AuthSessionController

class AuthRouteDescriptor:

    @classmethod
    def getRoutes(cls):
        contextRoot = ConfigurationManager.getInstance().getContextRoot()
        authSessionController = AuthSessionController()

        routes = [

            # Get authorization principal
            {
                'name'          : 'getAuthorizationPrincipal',
                'path'          : '%s/authorizationPrincipals/:(username)' % contextRoot,
                'controller'    : authSessionController,
                'action'        : 'getAuthorizationPrincipal',
                'method'        : [ 'GET' ]
            },

sveseli's avatar
sveseli committed
            # Add session
            {
                'name'          : 'addSession',
                'path'          : '%s/sessions/:(sessionId)' % contextRoot,
                'controller'    : authSessionController,
                'action'        : 'addSession',
                'method'        : [ 'POST' ]
            },

            # Check session
            {
                'name'          : 'checkSession',
                'path'          : '%s/sessions/:(sessionId)' % contextRoot,
                'controller'    : authSessionController,
                'action'        : 'checkSession',
                'method'        : [ 'PUT' ]
            },