Skip to content

Commit dfe843c

Browse files
committed
Implementation of RefreshToken refs #128
1 parent 9174864 commit dfe843c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

app/controllers/InstanceRegistryController.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
6262

6363
val instanceRegistryUri = config.get[String]("app.instanceRegistryUri")
6464
val instanceRegistryBasePath = config.get[String]("app.instanceRegistryBasePath")
65+
//val token = request.headers.get(HeaderNames.AUTHORIZATION)
66+
6567

6668

6769
/** This method maps list of instances with specific componentType.
@@ -252,4 +254,20 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
252254
}
253255
}(myExecutionContext)
254256
}
257+
258+
def refreshToken(token: String): Action[AnyContent] = authAction.async
259+
{
260+
request =>
261+
ws.url(instanceRegistryUri + "/users" + "/refreshToken")
262+
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
263+
.post("")
264+
.map { response =>
265+
response.status match {
266+
case 200 =>
267+
Ok(response.body)
268+
case 400 =>
269+
Unauthorized
270+
}
271+
}(myExecutionContext)
272+
}
255273
}

0 commit comments

Comments
 (0)