diff --git a/tes/apiendpoints.py b/tes/apiendpoints.py index 8d279454addc03640f4d2697ecd047784460dd37..d46480aac8aa0eb43afada1ff9963767ffd75cbf 100644 --- a/tes/apiendpoints.py +++ b/tes/apiendpoints.py @@ -434,6 +434,7 @@ class AppUrl(Resource): appdef = json.loads(request.args.get('app')) inst = json.loads(request.args.get('appinst')) inst['twsproxy']='{twsproxy}' + inst['twsproxyauth'] = request.cookies.get('twsproxyauth') url = "{}/{}".format("{twsproxy}",appdef['client']['redir'].format(**inst)) return url except Exception as e: @@ -443,6 +444,15 @@ class AppUrl(Resource): #flask_restful.abort(500,message="AppUrl failed in some unexpected way") return apiabort(500,message="AppUrl failed in some unexpected way") +class SetTWSProxyAuth(Resource): + def get(self, authtok): + import urllib.parse + url = urllib.parse.unquote(request.args.get(redirect)) + response = make_response(redirect(url)) + response.set_cookie('twsproxyauth', authtok, secure=True) + return response + + class Ping(Resource): def get(self): return None, 201 @@ -564,6 +574,7 @@ api.add_resource(GetCert, '/getcert') api.add_resource(JobStat, '/stat') api.add_resource(Ping, '/ping') api.add_resource(JobCancel, '/cancel/<int:jobid>') +api.add_resource(SetTWSProxyAuth, '/settwsproxyauth/<string:authtok>') api.add_resource(JobSubmit, '/submit') api.add_resource(CreateTunnel, '/createtunnel/<string:username>/<string:loginhost>/<string:batchhost>') api.add_resource(AppInstance, '/appinstance/<string:username>/<string:loginhost>/<string:batchhost>/<int:jobid>')