View DynamicRoute.scala
protected def currentConfig: Future[GatewayConfiguration] = {
(gatewayConfigurationManager ? GetGatewayConfig).mapTo[GatewayConfiguration]
}
val gatewayRoute: Route = (ctx: RequestContext) =>
currentConfig.flatMap { currentConfig =>
serviceRouteForResource(currentConfig, Config.gateway.prefix)(_.route)(ctx)
}
View auth-service.yaml
apiVersion: v1
kind: Service
metadata:
name: auth-service
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8080
selector:
View auth-service-deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: auth-service
spec:
template:
metadata:
labels:
app: auth-service
name: auth-service
View cupenya-microservice-service-descriptors.yaml
apiVersion: v1
kind: Service
metadata:
labels:
resource: users
name: users-service
spec:
ports:
- port: 80
protocol: TCP
View mongo-service.yaml
apiVersion: v1
kind: Endpoints
metadata:
name: mongo-svc
subsets:
- addresses:
- ip: 10.0.0.1
ports:
- port: 27017
protocol: TCP
View cupenya-microservice-descriptor.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: cupenya-microservice
spec:
replicas: 2
template:
metadata:
name: cupenya-microservice
labels:
View build.sbt
// begin docker template settings
enablePlugins(JavaServerAppPackaging)
enablePlugins(DockerPlugin)
publishArtifact in (Compile, packageDoc) := false
val shortCommit = ("git rev-parse --short HEAD" !!).replaceAll("\\n", "").replaceAll("\\r", "")
packageName in Docker := "my-docker-repo/" + name.value
version in Docker := shortCommit
View reference.conf
integration {
authentication {
host = "localhost"
host = ${?AUTH_HOST} // auth-service.default
port = 7070
port = ${?AUTH_PORT} // 80
}
kubernetes {
host = "localhost"
View jwtEncode.scala
val authInfo = AuthInfo(
referenceToken = "8dd95893-0915-4c3a",
userId = "bc522019-1445-4c1f-85fc-753342a71634",
permissions = Nil,
groupIds = Nil,
expirationDate = None
)
val claim = authInfo.toJson
val jwt = Jwt.encode(
JwtClaim(claim).issuedNow,
View AuthInfo.scala
sealed trait ClaimModel
case class AuthInfo(
referenceToken: String, // unique token
userId: String, // id of the user entity
permissions: List[String], // list of permission ids
groupIds: List[String], // list of group ids
expirationDate: Option[Long] // expiration date of the user account
) extends ClaimModel