From 837dba5b3769c383251db890d2eae9ff66c4c57b Mon Sep 17 00:00:00 2001 From: ayybeeshafi Date: Thu, 14 Mar 2019 10:38:02 +0100 Subject: [PATCH] Implementation of refreshToken refs #128 --- app/controllers/InstanceRegistryController.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/controllers/InstanceRegistryController.scala b/app/controllers/InstanceRegistryController.scala index b95a8266..76c10e86 100644 --- a/app/controllers/InstanceRegistryController.scala +++ b/app/controllers/InstanceRegistryController.scala @@ -252,4 +252,19 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma } }(myExecutionContext) } + def refreshToken(): Action[AnyContent] = authAction.async + { + request => + ws.url(instanceRegistryUri + "/users" + "/refreshToken") + .withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}")) + .post("") + .map { response => + response.status match { + case 200 => + Ok(response.body) + case 400 => + Unauthorized + } + }(myExecutionContext) + } }