Skip to content

Commit

Permalink
Implementation of RefreshToken refs #128
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayybeeshafi committed Mar 13, 2019
1 parent 9174864 commit dfe843c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/controllers/InstanceRegistryController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma

val instanceRegistryUri = config.get[String]("app.instanceRegistryUri")
val instanceRegistryBasePath = config.get[String]("app.instanceRegistryBasePath")
//val token = request.headers.get(HeaderNames.AUTHORIZATION)



/** This method maps list of instances with specific componentType.
Expand Down Expand Up @@ -252,4 +254,20 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
}
}(myExecutionContext)
}

def refreshToken(token: String): 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)
}
}

0 comments on commit dfe843c

Please sign in to comment.