Skip to content

Commit f7e7404

Browse files
committed
Implementation of refreshToken refs #128
1 parent dfe843c commit f7e7404

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

app/controllers/InstanceRegistryController.scala

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
6565
//val token = request.headers.get(HeaderNames.AUTHORIZATION)
6666

6767

68-
6968
/** This method maps list of instances with specific componentType.
7069
*
7170
* @param componentType
@@ -149,7 +148,8 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
149148
}
150149

151150
/**
152-
* This method is called to assign a new instance to the instance with specified ID.
151+
* This method is called to assign a new instance to the instance with specified ID.
152+
*
153153
* @param from
154154
* @param to
155155
* @return
@@ -226,36 +226,38 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
226226
new Status(response.status)
227227
}
228228
}
229-
}.getOrElse{ Future(BadRequest("Invalid body"))}
229+
}.getOrElse {
230+
Future(BadRequest("Invalid body"))
231+
}
230232

231-
}
233+
}
232234

233235
/**
234236
* This function is used to add a label to specific instance.
237+
*
235238
* @param instanceID ID of the instance on which label is to be added
236239
* @param label
237240
* @return
238241
*/
239242

240-
def labelInstance(instanceID: String, label: String): Action[AnyContent] = authAction.async
241-
{
243+
def labelInstance(instanceID: String, label: String): Action[AnyContent] = authAction.async {
242244
request =>
243-
ws.url(instanceRegistryUri + "/instances/" + instanceID + "/label")
244-
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
245-
.post(Json.obj("Label" -> label))
246-
.map { response =>
247-
response.status match {
248-
// scalastyle:off magic.number
249-
case 202 =>
250-
// scalastyle:on magic.number
251-
Ok(response.body)
252-
case x: Any =>
253-
new Status(x)
254-
}
255-
}(myExecutionContext)
245+
ws.url(instanceRegistryUri + "/instances/" + instanceID + "/label")
246+
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
247+
.post(Json.obj("Label" -> label))
248+
.map { response =>
249+
response.status match {
250+
// scalastyle:off magic.number
251+
case 202 =>
252+
// scalastyle:on magic.number
253+
Ok(response.body)
254+
case x: Any =>
255+
new Status(x)
256+
}
257+
}(myExecutionContext)
256258
}
257259

258-
def refreshToken(token: String): Action[AnyContent] = authAction.async
260+
def refreshToken(): Action[AnyContent] = authAction.async
259261
{
260262
request =>
261263
ws.url(instanceRegistryUri + "/users" + "/refreshToken")
@@ -270,4 +272,4 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
270272
}
271273
}(myExecutionContext)
272274
}
273-
}
275+
}

0 commit comments

Comments
 (0)