diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c0910b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM actionml/harness-sdk + +WORKDIR /app + +ADD . /tmp +ADD ./entrypoint.sh /app + +# RUN cd /tmp && \ +# ./make dist && \ +# cp -a ./auth-server/target/universal/stage/* /app/ && \ +# cd /app && \ +# rm -R /tmp/* + +RUN cd /tmp && \ + make dist && \ + cp -a ./auth-server/target/universal/stage/* /app/ && \ + cd /app && \ + rm -R /tmp/* + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/Makefile b/Makefile index d3c9a85..c73a159 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ .PHONY: sbt clean clean-dist build dist publish-local HARNESS_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) -SBT_SYSTEM_SCALA ?= no -SBT_URL ?= https://git.io/sbt -SBT ?= $(HARNESS_ROOT)/sbt/sbt +SBT_URL ?= https://raw.githubusercontent.com/sbt/sbt/v1.5.5/sbt +SBT_DIR ?= $(HARNESS_ROOT)/sbt +SBT ?= $(SBT_DIR)/sbt DIST ?= dist VERSION := $(shell grep ^version build.sbt | grep -o '".*"' | sed 's/"//g') @@ -17,21 +17,20 @@ ifeq ($(SBT),$(HARNESS_ROOT)/sbt/sbt) @ SBT_DIR="$$(dirname $(SBT))" && mkdir -p $$SBT_DIR && cd $$SBT_DIR && \ [ -x sbt ] || ( echo "Installing sbt extras locally (from $(SBT_URL))"; \ which curl &> /dev/null && ( curl \-#SL -o sbt \ - https://git.io/sbt && chmod 0755 sbt || exit 1; ) || \ - ( which wget &>/dev/null && wget -O sbt https://git.io/sbt && chmod 0755 sbt; ) \ + $(SBT_URL) && chmod 0755 sbt || exit 1; ) || \ + ( which wget &>/dev/null && wget -O sbt $(SBT_URL) && chmod 0755 sbt; ) \ ) endif build: sbt - $(SBT) ++$(SCALA_VERSION) -batch authServer/universal:stage + $(SBT) authServer/universal:stage publish-local: build - $(SBT) ++$(SCALA_VERSION) -batch harnessAuthCommon/publish-local + $(SBT) harnessAuthCommon/publish-local clean: sbt - $(SBT) ++$(SCALA_VERSION) -batch harnessAuthCommon/clean - $(SBT) ++$(SCALA_VERSION) -batch authServer/clean + $(SBT) clean dist: clean clean-dist build mkdir -p $(DIST) && cd $(DIST) && mkdir bin conf logs lib diff --git a/auth-server/src/main/resources/application.conf b/auth-server/src/main/resources/application.conf index 9bb820d..7ce7216 100644 --- a/auth-server/src/main/resources/application.conf +++ b/auth-server/src/main/resources/application.conf @@ -36,7 +36,8 @@ auth-server { "engine_create", "engine_read", "event_create", - "query_create" + "query_create", + "system_info" ] }, { diff --git a/build.sbt b/build.sbt index 4f751d4..b5a161d 100644 --- a/build.sbt +++ b/build.sbt @@ -2,8 +2,6 @@ import sbt.Keys.resolvers name := "harness-auth-server" -version := "0.3.0" - scalaVersion := "2.11.12" lazy val akkaVersion = "2.4.18" @@ -11,18 +9,22 @@ lazy val akkaHttpVersion = "10.0.9" lazy val circeVersion = "0.8.0" lazy val scalaTestVersion = "3.0.1" -resolvers += Resolver.bintrayRepo("hseeberger", "maven") -resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" -resolvers += "Novus Release Repository" at "http://repo.novus.com/releases/" +resolvers += Resolver.bintrayRepo("hseeberger", "maven").withAllowInsecureProtocol(true) +resolvers += ("Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots").withAllowInsecureProtocol(true) +resolvers += Resolver.typesafeRepo("releases").withAllowInsecureProtocol(true) + +lazy val root = (project in file(".")).settings( + publishArtifact := false +) lazy val commonSettings = Seq( organization := "com.actionml", - version := "0.3.0", + version := "0.3.1", scalaVersion := "2.11.12", updateOptions := updateOptions.value.withLatestSnapshots(false), - resolvers += Resolver.bintrayRepo("hseeberger", "maven"), - resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", - resolvers += Resolver.mavenLocal, + resolvers += Resolver.bintrayRepo("hseeberger", "maven").withAllowInsecureProtocol(true), + resolvers += ("Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots").withAllowInsecureProtocol(true), + resolvers += Resolver.mavenLocal.withAllowInsecureProtocol(true), libraryDependencies ++= Seq( "ch.qos.logback" % "logback-classic" % "1.2.3", "org.slf4j" % "log4j-over-slf4j" % "1.7.25", @@ -47,6 +49,7 @@ lazy val harnessAuthCommon = (project in file("harness-auth-common")). pomIncludeRepository := { _ => false }, licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")), sonatypeProjectHosting := Some(GitHubHosting("actionml", "harness-auth-server", "andrey@actionml.com")), + usePgpKeyHex("513353D6872892A57B0C1ED9639726BABE7BC0C8"), publishTo := { val nexus = "https://oss.sonatype.org/" if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots") diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..1ef0d08 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec /app/bin/authserver \ No newline at end of file diff --git a/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala b/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala index b6e0f1d..ded8c81 100644 --- a/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala +++ b/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala @@ -41,4 +41,8 @@ object Roles { val create = "user_create" val permissions = "user_permissions" } + + object system { + val info = "system_info" + } } diff --git a/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala b/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala index f8d812a..6c96132 100644 --- a/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala +++ b/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala @@ -41,7 +41,7 @@ trait AuthorizationDirectives extends RouteDirectives with BasicDirectives with } def hasAccess(role: RoleId, resourceId: ResourceId = ResourceId.*) - (implicit as: ActorSystem, mat: ActorMaterializer, ec: ExecutionContext, accessTokenOpt: Option[AccessToken], log: LoggingAdapter): Directive0 = { + (implicit ec: ExecutionContext, accessTokenOpt: Option[AccessToken], log: LoggingAdapter): Directive0 = { if (authEnabled) { accessTokenOpt.fold[Directive0] { reject(AuthorizationFailedRejection) diff --git a/project/build.properties b/project/build.properties index cd7364c..215ddd2 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 0.13.17 \ No newline at end of file +sbt.version = 1.5.5 \ No newline at end of file