-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade keycloak version to 14 (keycloak download url now points to g…
…ithub releases page)
- Loading branch information
Showing
10 changed files
with
86 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version = "2.5.3" | ||
version = "2.7.5" | ||
|
||
align = most | ||
newlines.alwaysBeforeElseAfterCurlyIf = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
embedded-keycloak/src/main/scala/org/tmt/embedded_keycloak/impl/download/AkkaHttpUtils.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.tmt.embedded_keycloak.impl.download | ||
|
||
import akka.actor.ActorSystem | ||
import akka.http.scaladsl.Http | ||
import akka.http.scaladsl.model.headers.Location | ||
import akka.http.scaladsl.model.{HttpRequest, HttpResponse, StatusCodes} | ||
|
||
import scala.concurrent.{ExecutionContext, Future} | ||
|
||
object AkkaHttpUtils { | ||
|
||
private val maxRedirectCount = 3 | ||
|
||
// akka-http does not support redirects - https://github.com/akka/akka-http/issues/195 | ||
def singleRequestWithRedirect(req: HttpRequest)(implicit system: ActorSystem): Future[HttpResponse] = { | ||
implicit val ec: ExecutionContext = system.dispatcher | ||
|
||
def go(req: HttpRequest, count: Int): Future[HttpResponse] = | ||
Http().singleRequest(req).flatMap { resp => | ||
resp.status match { | ||
case StatusCodes.Found => | ||
resp | ||
.header[Location] | ||
.map { loc => | ||
val newReq = req.withUri(loc.uri) | ||
if (count < maxRedirectCount) go(newReq, count + 1) else Http().singleRequest(newReq) | ||
} | ||
.getOrElse(throw new RuntimeException(s"location not found on 302 for ${req.uri}")) | ||
case _ => Future(resp) | ||
} | ||
} | ||
|
||
go(req, 0) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters