Skip to content

Commit

Permalink
Merge pull request #28 from ing-bank/fix/rename-airlock
Browse files Browse the repository at this point in the history
rename airlock to rokku
  • Loading branch information
arempter authored Apr 19, 2019
2 parents b85beb4 + 20edb9e commit d8ab67b
Show file tree
Hide file tree
Showing 49 changed files with 208 additions and 193 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ script:

after_success:
- bash <(curl -s https://codecov.io/bash)
- export AIRLOCK_STS_VERSION="${TRAVIS_BRANCH/\//_}"
- export ROKKU_STS_VERSION="${TRAVIS_BRANCH/\//_}"
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- if [ "${TRAVIS_BRANCH}" != "master" ]; then
echo "Build image for with name $DOCKER_REPO:$AIRLOCK_STS_VERSION";
echo "Build image for with name $DOCKER_REPO:$ROKKU_STS_VERSION";
sbt clean docker:publish;
fi
- if [ -n "$TRAVIS_TAG" ]; then
docker tag $DOCKER_REPO:$AIRLOCK_STS_VERSION $DOCKER_REPO:latest;
docker tag $DOCKER_REPO:$ROKKU_STS_VERSION $DOCKER_REPO:latest;
docker push $DOCKER_REPO:latest;
fi
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import com.typesafe.sbt.packager.docker
import com.typesafe.sbt.packager.docker.ExecCmd
import scalariform.formatter.preferences._

val airlockStsVersion = scala.sys.env.getOrElse("AIRLOCK_STS_VERSION", "SNAPSHOT")
val rokkuStsVersion = scala.sys.env.getOrElse("ROKKU_STS_VERSION", "SNAPSHOT")

name := "airlock-sts"
version := airlockStsVersion
name := "rokku-sts"
version := rokkuStsVersion
scalaVersion := "2.12.8"

scalacOptions := Seq(
Expand All @@ -21,7 +21,7 @@ scalacOptions := Seq(
// Experimental: improved update resolution.
updateOptions := updateOptions.value.withCachedResolution(cachedResoluton = true)

assemblyJarName in assembly := "airlock-sts.jar"
assemblyJarName in assembly := "rokku-sts.jar"

val akkaVersion = "2.5.19"
val akkaHttpVersion = "10.1.5"
Expand Down Expand Up @@ -59,7 +59,7 @@ Defaults.itSettings
parallelExecution in IntegrationTest := false

javaOptions in Universal ++= Seq(
"-Dlogback.configurationFile=/airlock/logback.xml"
"-Dlogback.configurationFile=/rokku/logback.xml"
)

enablePlugins(JavaAppPackaging)
Expand All @@ -69,7 +69,7 @@ fork := true
dockerExposedPorts := Seq(12345)
dockerCommands += ExecCmd("ENV", "PROXY_HOST", "0.0.0.0")
dockerBaseImage := "openjdk:8u171-jre-slim-stretch"
dockerAlias := docker.DockerAlias(Some("docker.io"), Some("wbaa"), "airlock-sts", Some(airlockStsVersion))
dockerAlias := docker.DockerAlias(Some("docker.io"), Some("wbaa"), "rokku-sts", Some(rokkuStsVersion))

scalariformPreferences := scalariformPreferences.value
.setPreference(AlignSingleLineCaseStatements, true)
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ version: "2"
services:

keycloak:
image: wbaa/airlock-dev-keycloak:0.0.3
image: wbaa/rokku-dev-keycloak:0.0.5
environment:
- KEYCLOAK_USER=admin
- KEYCLOAK_PASSWORD=admin
ports:
- 8080:8080

mariadb:
image: wbaa/airlock-dev-mariadb:0.0.2
image: wbaa/rokku-dev-mariadb:0.0.3
environment:
- MYSQL_ROOT_PASSWORD=admin
ports:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ing.wbaa.airlock.sts
package com.ing.wbaa.rokku.sts

import akka.http.scaladsl.model.Uri.Authority
import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ing.wbaa.airlock.sts
package com.ing.wbaa.rokku.sts

import java.time.Instant

Expand All @@ -7,14 +7,14 @@ import akka.http.scaladsl.model.Uri.{Authority, Host}
import akka.stream.ActorMaterializer
import com.amazonaws.services.securitytoken.AWSSecurityTokenService
import com.amazonaws.services.securitytoken.model.{AWSSecurityTokenServiceException, GetSessionTokenRequest}
import com.ing.wbaa.airlock.sts.config.{HttpSettings, KeycloakSettings, MariaDBSettings, StsSettings}
import com.ing.wbaa.airlock.sts.data.UserName
import com.ing.wbaa.airlock.sts.data.aws._
import com.ing.wbaa.airlock.sts.helper.{KeycloackToken, OAuth2TokenRequest}
import com.ing.wbaa.airlock.sts.keycloak.KeycloakTokenVerifier
import com.ing.wbaa.airlock.sts.service.UserTokenDbService
import com.ing.wbaa.airlock.sts.service.db.MariaDb
import com.ing.wbaa.airlock.sts.service.db.dao.STSUserAndGroupDAO
import com.ing.wbaa.rokku.sts.config.{HttpSettings, KeycloakSettings, MariaDBSettings, StsSettings}
import com.ing.wbaa.rokku.sts.data.UserName
import com.ing.wbaa.rokku.sts.data.aws._
import com.ing.wbaa.rokku.sts.helper.{KeycloackToken, OAuth2TokenRequest}
import com.ing.wbaa.rokku.sts.keycloak.KeycloakTokenVerifier
import com.ing.wbaa.rokku.sts.service.UserTokenDbService
import com.ing.wbaa.rokku.sts.service.db.MariaDb
import com.ing.wbaa.rokku.sts.service.db.dao.STSUserAndGroupDAO
import org.scalatest._

import scala.concurrent.duration.Duration
Expand All @@ -27,10 +27,10 @@ class StsServiceItTest extends AsyncWordSpec with DiagrammedAssertions
override implicit val materializer: ActorMaterializer = ActorMaterializer()(testSystem)
override implicit val exContext: ExecutionContextExecutor = testSystem.dispatcher

private val validCredentials = Map("grant_type" -> "password", "username" -> "userone", "password" -> "password", "client_id" -> "sts-airlock")
private val validCredentials = Map("grant_type" -> "password", "username" -> "userone", "password" -> "password", "client_id" -> "sts-rokku")
private val invalidCredentials = validCredentials + ("password" -> "xxx")

private[this] val airlockHttpSettings: HttpSettings = new HttpSettings(testSystem.settings.config) {
private[this] val rokkuHttpSettings: HttpSettings = new HttpSettings(testSystem.settings.config) {
override val httpPort: Int = 0
override val httpBind: String = "127.0.0.1"
}
Expand All @@ -52,11 +52,11 @@ class StsServiceItTest extends AsyncWordSpec with DiagrammedAssertions
with MariaDb {
override implicit def system: ActorSystem = testSystem

override protected[this] def httpSettings: HttpSettings = airlockHttpSettings
override protected[this] def httpSettings: HttpSettings = rokkuHttpSettings

override protected[this] def keycloakSettings: KeycloakSettings = new KeycloakSettings(testSystem.settings.config) {
override val realmPublicKeyId: String = "FJ86GcF3jTbNLOco4NvZkUCIUmfYCqoqtOQeMfbhNlE"
override val issuerForList: Set[String] = Set("sts-airlock")
override val issuerForList: Set[String] = Set("sts-rokku")
}

override protected[this] def stsSettings: StsSettings = StsSettings(testSystem)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.ing.wbaa.airlock.sts.helper
package com.ing.wbaa.rokku.sts.helper

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.RawHeader
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.Sink
import com.ing.wbaa.airlock.sts.config.KeycloakSettings
import com.ing.wbaa.rokku.sts.config.KeycloakSettings

import scala.concurrent.{ExecutionContextExecutor, Future}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.ing.wbaa.airlock.sts.keycloak
package com.ing.wbaa.rokku.sts.keycloak

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import com.ing.wbaa.airlock.sts.config.KeycloakSettings
import com.ing.wbaa.airlock.sts.data.{BearerToken, UserGroup, UserName}
import com.ing.wbaa.airlock.sts.helper.{KeycloackToken, OAuth2TokenRequest}
import com.ing.wbaa.rokku.sts.config.KeycloakSettings
import com.ing.wbaa.rokku.sts.data.{BearerToken, UserGroup, UserName}
import com.ing.wbaa.rokku.sts.helper.{KeycloackToken, OAuth2TokenRequest}
import org.keycloak.common.VerificationException
import org.keycloak.representations.JsonWebToken
import org.scalatest.{Assertion, AsyncWordSpec, DiagrammedAssertions}
Expand All @@ -19,15 +19,15 @@ class KeycloakTokenVerifierTest extends AsyncWordSpec with DiagrammedAssertions

override val keycloakSettings: KeycloakSettings = new KeycloakSettings(testSystem.settings.config) {
override val realmPublicKeyId: String = "FJ86GcF3jTbNLOco4NvZkUCIUmfYCqoqtOQeMfbhNlE"
override val issuerForList: Set[String] = Set("sts-airlock")
override val issuerForList: Set[String] = Set("sts-rokku")
}

private def withOAuth2TokenRequest(formData: Map[String, String])(testCode: KeycloackToken => Assertion): Future[Assertion] = {
keycloackToken(formData).map(testCode)
}

private val validCredentialsUser1 = Map("grant_type" -> "password", "username" -> "userone", "password" -> "password", "client_id" -> "sts-airlock")
private val validCredentialsUser2 = Map("grant_type" -> "password", "username" -> "testuser", "password" -> "password", "client_id" -> "sts-airlock")
private val validCredentialsUser1 = Map("grant_type" -> "password", "username" -> "userone", "password" -> "password", "client_id" -> "sts-rokku")
private val validCredentialsUser2 = Map("grant_type" -> "password", "username" -> "testuser", "password" -> "password", "client_id" -> "sts-rokku")

"Keycloak verifier" should {
"return verified token for user 1" in withOAuth2TokenRequest(validCredentialsUser1) { keycloakToken =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ing.wbaa.airlock.sts.service.db
package com.ing.wbaa.rokku.sts.service.db

import akka.actor.ActorSystem
import com.ing.wbaa.airlock.sts.config.{MariaDBSettings, StsSettings}
import com.ing.wbaa.rokku.sts.config.{MariaDBSettings, StsSettings}
import org.scalatest.AsyncWordSpec

import scala.util.{Failure, Success}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.ing.wbaa.airlock.sts.service.db.dao
package com.ing.wbaa.rokku.sts.service.db.dao

import java.time.Instant

import akka.actor.ActorSystem
import com.ing.wbaa.airlock.sts.config.{MariaDBSettings, StsSettings}
import com.ing.wbaa.airlock.sts.data.UserName
import com.ing.wbaa.airlock.sts.data.aws.{AwsCredential, AwsSessionToken, AwsSessionTokenExpiration}
import com.ing.wbaa.airlock.sts.service.TokenGeneration
import com.ing.wbaa.airlock.sts.service.db.MariaDb
import com.ing.wbaa.rokku.sts.config.{MariaDBSettings, StsSettings}
import com.ing.wbaa.rokku.sts.data.UserName
import com.ing.wbaa.rokku.sts.data.aws.{AwsCredential, AwsSessionToken, AwsSessionTokenExpiration}
import com.ing.wbaa.rokku.sts.service.TokenGeneration
import com.ing.wbaa.rokku.sts.service.db.MariaDb
import org.scalatest.{Assertion, AsyncWordSpec}

import scala.concurrent.Future
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.ing.wbaa.airlock.sts.service.db.dao
package com.ing.wbaa.rokku.sts.service.db.dao

import akka.actor.ActorSystem
import com.ing.wbaa.airlock.sts.config.{MariaDBSettings, StsSettings}
import com.ing.wbaa.airlock.sts.data.{UserGroup, UserName}
import com.ing.wbaa.airlock.sts.data.aws.{AwsAccessKey, AwsCredential}
import com.ing.wbaa.airlock.sts.service.TokenGeneration
import com.ing.wbaa.airlock.sts.service.db.MariaDb
import com.ing.wbaa.rokku.sts.config.{MariaDBSettings, StsSettings}
import com.ing.wbaa.rokku.sts.data.{UserGroup, UserName}
import com.ing.wbaa.rokku.sts.data.aws.{AwsAccessKey, AwsCredential}
import com.ing.wbaa.rokku.sts.service.TokenGeneration
import com.ing.wbaa.rokku.sts.service.db.MariaDb
import org.scalatest.AsyncWordSpec

import scala.util.Random
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ akka {
}
}

airlock {
rokku {
sts {
# Default interface and port to listen on.
http {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- encoders are by default assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="com.ing.wbaa.airlock.sts.util.MaskingPatternJsonLayout">
<layout class="com.ing.wbaa.rokku.sts.util.MaskingPatternJsonLayout">
<!-- Insert here the regexes to sanitize the log messages.
Replacement supports pattern groups with variables named $1, $2, etc -->
<replace>
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
airlock {
rokku {
sts {
# Default interface and port to listen on.
http {
Expand All @@ -8,8 +8,8 @@ airlock {
# Default keycloak configuration file and realm public key id
keycloak {
realmPublicKeyId = "FJ86GcF3jTbNLOco4NvZkUCIUmfYCqoqtOQeMfbhNlE"
realm = "auth-airlock"
resource = "sts-airlock"
realm = "auth-rokku"
resource = "sts-rokku"
url = "http://127.0.0.1:8080"

verifyToken {
Expand All @@ -29,7 +29,7 @@ airlock {


mariadb {
url = "jdbc:mysql:loadbalance://localhost:3307,localhost:3307/airlock"
url = "jdbc:mysql:loadbalance://localhost:3307,localhost:3307/rokku"
username = "root"
password = "admin"
}
Expand Down

This file was deleted.

24 changes: 0 additions & 24 deletions src/main/scala/com/ing/wbaa/airlock/sts/config/StsSettings.scala

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ing.wbaa.airlock.sts
package com.ing.wbaa.rokku.sts

import akka.Done
import akka.actor.ActorSystem
Expand All @@ -7,8 +7,8 @@ import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import akka.stream.ActorMaterializer
import ch.megard.akka.http.cors.scaladsl.CorsDirectives.cors
import com.ing.wbaa.airlock.sts.api.{ AdminApi, STSApi, ServerApi, UserApi }
import com.ing.wbaa.airlock.sts.config.HttpSettings
import com.ing.wbaa.rokku.sts.api.{ AdminApi, STSApi, ServerApi, UserApi }
import com.ing.wbaa.rokku.sts.config.HttpSettings
import com.typesafe.scalalogging.LazyLogging

import scala.concurrent.{ ExecutionContext, Future }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.ing.wbaa.airlock.sts
package com.ing.wbaa.rokku.sts

import akka.actor.ActorSystem
import com.ing.wbaa.airlock.sts.config._
import com.ing.wbaa.airlock.sts.keycloak.KeycloakTokenVerifier
import com.ing.wbaa.airlock.sts.service.UserTokenDbService
import com.ing.wbaa.airlock.sts.service.db.MariaDb
import com.ing.wbaa.airlock.sts.service.db.dao.{ STSTokenDAO, STSUserAndGroupDAO }
import com.ing.wbaa.rokku.sts.config._
import com.ing.wbaa.rokku.sts.keycloak.KeycloakTokenVerifier
import com.ing.wbaa.rokku.sts.service.UserTokenDbService
import com.ing.wbaa.rokku.sts.service.db.MariaDb
import com.ing.wbaa.rokku.sts.service.db.dao.{ STSTokenDAO, STSUserAndGroupDAO }

object Server extends App {
new AirlockStsService with KeycloakTokenVerifier with UserTokenDbService with STSUserAndGroupDAO with STSTokenDAO with MariaDb {
override implicit lazy val system: ActorSystem = ActorSystem.create("airlock-sts")
override implicit lazy val system: ActorSystem = ActorSystem.create("rokku-sts")

override protected[this] def httpSettings: HttpSettings = HttpSettings(system)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.ing.wbaa.airlock.sts.api
package com.ing.wbaa.rokku.sts.api

import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.{ AuthorizationFailedRejection, Route }
import com.ing.wbaa.airlock.sts.api.directive.STSDirectives.authorizeToken
import com.ing.wbaa.airlock.sts.config.StsSettings
import com.ing.wbaa.airlock.sts.data.aws.{ AwsAccessKey, AwsCredential, AwsSecretKey }
import com.ing.wbaa.airlock.sts.data.{ AuthenticationUserInfo, BearerToken, UserGroup, UserName }
import com.ing.wbaa.airlock.sts.service.db.security.Encryption
import com.ing.wbaa.rokku.sts.api.directive.STSDirectives.authorizeToken
import com.ing.wbaa.rokku.sts.config.StsSettings
import com.ing.wbaa.rokku.sts.data.aws.{ AwsAccessKey, AwsCredential, AwsSecretKey }
import com.ing.wbaa.rokku.sts.data.{ AuthenticationUserInfo, BearerToken, UserGroup, UserName }
import com.ing.wbaa.rokku.sts.service.db.security.Encryption
import com.typesafe.scalalogging.LazyLogging

import scala.concurrent.Future
Expand Down
Loading

0 comments on commit d8ab67b

Please sign in to comment.