Skip to content

Commit

Permalink
Co-authored-by: Bilal Fazlani <[email protected]>
Browse files Browse the repository at this point in the history
  • Loading branch information
Dollyg committed Feb 6, 2019
1 parent 56d98ad commit 42e8ad0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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(
Expand Down

0 comments on commit 42e8ad0

Please sign in to comment.