From 42e8ad047cb91002fed74ccfe28011416356513d Mon Sep 17 00:00:00 2001 From: Dollyg <> Date: Wed, 6 Feb 2019 16:21:01 +0530 Subject: [PATCH] Co-authored-by: Bilal Fazlani --- .../embedded_keycloak/EmbeddedKeycloak.scala | 2 +- .../impl/data/AdminFeeder.scala | 28 ++----------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/main/scala/tech/bilal/embedded_keycloak/EmbeddedKeycloak.scala b/src/main/scala/tech/bilal/embedded_keycloak/EmbeddedKeycloak.scala index d277304..0876c7b 100644 --- a/src/main/scala/tech/bilal/embedded_keycloak/EmbeddedKeycloak.scala +++ b/src/main/scala/tech/bilal/embedded_keycloak/EmbeddedKeycloak.scala @@ -26,7 +26,7 @@ class EmbeddedKeycloak(keycloakData: KeycloakData, val fileIO = new FileIO(settings) - def preRun(): Unit = { + private def preRun(): Unit = { installer.install() ports.checkAvailability(port = port, throwOnError = true) } diff --git a/src/main/scala/tech/bilal/embedded_keycloak/impl/data/AdminFeeder.scala b/src/main/scala/tech/bilal/embedded_keycloak/impl/data/AdminFeeder.scala index f6b67e3..aa6e194 100644 --- a/src/main/scala/tech/bilal/embedded_keycloak/impl/data/AdminFeeder.scala +++ b/src/main/scala/tech/bilal/embedded_keycloak/impl/data/AdminFeeder.scala @@ -28,25 +28,12 @@ private[embedded_keycloak] class RestAdminFeeder(settings: Settings) with AdminFeeder { override def feedAdminUser(admin: AdminUser): Unit = { - val origin = s"http://${settings.host}:${settings.port}" + val origin = s"http://localhost:${settings.port}" val referer = origin + "/" val url = referer + "auth/" val cookieName = "WELCOME_STATE_CHECKER" - val getResponse = get( - url = url, - headers = Map( - "Connection" -> "keep-alive", - "Pragma" -> "no-cache", - "Cache-Control" -> "Cache-Control", - "Upgrade-Insecure-Requests" -> "1", - "User-Agent" -> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", - "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "Referer" -> referer, - "Accept-Encoding" -> "gzip, deflate, br", - "Accept-Language" -> "en-US,en;q=0.9" - ), - ) + val getResponse = get(url = url) if (getResponse.statusCode != 200) throw new RuntimeException("could not create admin user") @@ -58,17 +45,6 @@ private[embedded_keycloak] class RestAdminFeeder(settings: Settings) val postResponse = post( url = url, - headers = Map( - "Connection" -> "keep-alive", - "Cache-Control" -> "max-age=0", - "Origin" -> origin, - "Upgrade-Insecure-Requests" -> "1", - "Content-Type" -> "application/x-www-form-urlencoded", - "User-Agent" -> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", - "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "Referer" -> url, - "Accept-Language" -> "en-US,en;q=0.9,gl;q=0.8,de;q=0.7" - ), cookies = cookies, data = RequestBlob.FormEncodedRequestBlob( Map(