Commit 711b677a authored by mouadh's avatar mouadh

authentication

parent 9253dd67
......@@ -15,6 +15,18 @@ class ConfigParser:
def config_file_exist(self):
return os.path.isfile(os.path.join(self.cube_path, self.file_name))
def xmla_authentication(self):
with open(os.path.join(self.cube_path, self.file_name)) as config_file:
parser = etree.XMLParser()
tree = etree.parse(config_file, parser)
try:
return tree.xpath('/cubes/xmla_authentication')[0].text == 'True'
except:
return False
def get_cubes_names(self):
with open(os.path.join(self.cube_path, self.file_name)) as config_file:
......
......@@ -11,6 +11,7 @@ from spyne import AnyXml, Application, ServiceBase, rpc
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
from ..mdx.tools.config_file_parser import ConfigParser
from ..services.models import DiscoverRequest, ExecuteRequest, Session
from .xmla_discover_tools import XmlaDiscoverTools
from .xmla_execute_tools import XmlaExecuteTools
......@@ -55,6 +56,13 @@ class XmlaProviderService(ServiceBase):
discover_tools = XmlaProviderService.discover_tools
ctx.out_header = Session(SessionId=str(XmlaProviderService.SessionId))
config_parser = ConfigParser(discover_tools.executer.cube_path)
if config_parser.xmla_authentication():
# TODO call labster login or create login with token (according to labster db)
if ctx.transport.req_env['QUERY_STRING'] != 'mouadh':
return ''
if request.RequestType == "DISCOVER_DATASOURCES":
return discover_tools.discover_datasources_response()
......@@ -235,7 +243,8 @@ def start_server(write_on_file=False):
logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG)
logging.info("listening to http://127.0.0.1:8000/xmla")
logging.info("wsdl is at: http://localhost:8000/xmla?wsdl")
server = make_server('127.0.0.1', 8000, wsgi_application)
# server = make_server('127.0.0.1', 8000, wsgi_application)
server = make_server('192.168.101.139', 8000, wsgi_application)
server.serve_forever()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment