Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added systemInfo role to harness-common #8

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion auth-server/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ auth-server {
"engine_create",
"engine_read",
"event_create",
"query_create"
"query_create",
"system_info"
]
},
{
Expand Down
21 changes: 12 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@ import sbt.Keys.resolvers

name := "harness-auth-server"

version := "0.3.0"

scalaVersion := "2.11.12"

lazy val akkaVersion = "2.4.18"
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",
Expand All @@ -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", "[email protected]")),
usePgpKeyHex("513353D6872892A57B0C1ED9639726BABE7BC0C8"),
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec /app/bin/authserver
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ object Roles {
val create = "user_create"
val permissions = "user_permissions"
}

object system {
val info = "system_info"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 0.13.17
sbt.version = 1.5.5