Skip to content
Merged
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
71 changes: 71 additions & 0 deletions .github/actions/setup-sbt/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# From https://github.com/sbt/setup-sbt
name: "Setup sbt installer"
description: "Sets up sbt runner script"
inputs:
sbt-runner-version:
description: "The runner version (The actual version is controlled via project/build.properties)"
required: true
default: 1.11.7
runs:
using: "composite"
steps:
- name: Set up cache paths
id: cache-paths
shell: bash
env:
SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }}
SBT_CACHE_KEY_VERSION: 1.1.6
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "sbt_toolpath=$RUNNER_TOOL_CACHE\\sbt\\$SBT_RUNNER_VERSION" >> "$GITHUB_OUTPUT"
echo "sbt_downloadpath=$RUNNER_TEMP\\_sbt" >> "$GITHUB_OUTPUT"
else
echo "sbt_toolpath=$RUNNER_TOOL_CACHE/sbt/$SBT_RUNNER_VERSION" >> "$GITHUB_OUTPUT"
echo "sbt_downloadpath=$RUNNER_TEMP/_sbt" >> "$GITHUB_OUTPUT"
fi
echo "sbt_cachekey=$RUNNER_OS-sbt-$SBT_RUNNER_VERSION-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT"
- name: Check Tool Cache
id: cache-tool-dir
shell: bash
env:
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
run: |
if [[ -f "$SBT_TOOLPATH/sbt/bin/sbt" ]]; then
echo "cache-hit=true" >> "$GITHUB_OUTPUT"
else
mkdir -p "$SBT_TOOLPATH"
echo "cache-hit=false" >> "$GITHUB_OUTPUT"
fi
- name: Cache sbt distribution
id: cache-dir
if: steps.cache-tool-dir.outputs.cache-hit != 'true'
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: ${{ steps.cache-paths.outputs.sbt_toolpath }}
key: ${{ steps.cache-paths.outputs.sbt_cachekey }}
- name: "Download and Install sbt"
shell: bash
env:
SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }}
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
SBT_DOWNLOADPATH: "${{ steps.cache-paths.outputs.sbt_downloadpath }}"
if: steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-dir.outputs.cache-hit != 'true'
run: |
mkdir -p "$SBT_DOWNLOADPATH"
curl -sL "https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip" > \
"$SBT_DOWNLOADPATH/sbt-$SBT_RUNNER_VERSION.zip"

cd "$SBT_DOWNLOADPATH"
unzip -o "sbt-$SBT_RUNNER_VERSION.zip" -d "$SBT_TOOLPATH"
- name: "Setup PATH"
shell: bash
env:
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
run: |
cd "$SBT_TOOLPATH"
ls sbt/bin/sbt
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "$PWD\\sbt\\bin" >> "$GITHUB_PATH"
else
echo "$PWD/sbt/bin" >> "$GITHUB_PATH"
fi
9 changes: 6 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ name: Publish

on:
push:
branches: [ master ]
branches: [ main ]
tags: ["*"]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: Set up SBT
uses: ./.github/actions/setup-sbt
- name: Publish
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/publish_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ jobs:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: Set up SBT
uses: ./.github/actions/setup-sbt
- name: Publish
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ name: Scala CI

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
java11:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Run tests
run: sbt scalafmtSbtCheck scalafmtCheckAll +testOnly
- uses: actions/checkout@v5
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: Set up SBT
uses: ./.github/actions/setup-sbt
- name: Run tests
run: sbt scalafmtSbtCheck scalafmtCheckAll +testOnly
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ repos:
hooks:
- id: scalafmt
stages: [commit]
args: [-c .scalafmt.conf, -d./bin, -v2.4.2, -oorg.scalameta]
args: [-c .scalafmt.conf, -d./bin, -v3.10.2, -oorg.scalameta]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[![Build Status](https://travis-ci.org/StackVista/akka-http-pac4j.svg?branch=master)](https://travis-ci.org/StackVista/akka-http-pac4j)

## akka-http-pac4j ##
Based on [akka-http-pac4j](https://github.com/StackVista/akka-http-pac4j).

## pekko-http-pac4j ##
A wrapper around pac4j (www.pac4j.org) built using AkkaHTTP

## how to use it ##
Expand Down
73 changes: 18 additions & 55 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,65 +1,28 @@
import Dependencies._

inThisBuild(
List(organization := "com.stackstate", scalaVersion := "2.12.13", crossScalaVersions := Seq(scalaVersion.value, "2.13.5"), libraryDependencies ++= {
// Silencer
val silencerVersion = "1.7.3"

Seq(
compilerPlugin(("com.github.ghik" %% "silencer-plugin" % silencerVersion).cross(CrossVersion.full)),
("com.github.ghik" %% "silencer-lib" % silencerVersion % Provided).cross(CrossVersion.full)
)
})
)
inThisBuild(List(organization := "io.github.stackvista", scalaVersion := "2.13.13"))

lazy val root = (project in file(".")).settings(
name := "akka-http-pac4j",
libraryDependencies ++= Seq(akkaHttp, akkaStream, pac4j, scalaTestCore % Test, scalacheck % Test, akkaHttpTestKit % Test, akkaStreamTestKit % Test),
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-explaintypes",
"-unchecked",
"-deprecation",
"-feature",
//"-language:higherKinds",
"-Xlint",
"-g:vars"
name := "pekko-http-pac4j",
libraryDependencies ++= Seq(
pekkoHttp,
pekkoStream,
pac4j,
scalaCompat,
scalaTestCore % Test,
scalacheck % Test,
pekkoHttpTestKit % Test,
pekkoStreamTestKit % Test
),
scalacOptions ++= {
if (scalaBinaryVersion.value == "2.13") {
Seq("-Werror", "-Wnumeric-widen", "-Wdead-code", "-Wvalue-discard", "-Wunused", "-Wmacros:after", "-Woctal-literal", "-Wextra-implicit")

} else {
Seq(
"-Xfatal-warnings",
"-Ywarn-numeric-widen",
"-Ywarn-dead-code",
"-Ywarn-value-discard",
"-Ywarn-infer-any",
"-Ywarn-unused",
"-Ywarn-unused-import",
"-Ywarn-macros:after"
)
}
},
scalacOptions in Test ~= {
_.filterNot(_ == "-Werror")
},
scalacOptions ++= {
if (scalaBinaryVersion.value == "2.13") {
Seq("-P:silencer:globalFilters=scala.jdk.CollectionConverters")
} else {
Seq.empty
}
},
scalacOptions in Test += "-P:silencer:globalFilters=discarded\\ non-Unit",
scalacOptions in (Compile, console) ~= {
scalacOptions ++= Seq("-encoding", "UTF-8", "-explaintypes", "-unchecked", "-deprecation", "-feature", "-Xlint", "-g:vars"),
scalacOptions ++= Seq("-Werror", "-Wnumeric-widen", "-Wdead-code", "-Wvalue-discard", "-Wmacros:after", "-Woctal-literal", "-Wextra-implicit"),
Test / scalacOptions := Seq("-Wconf:msg=unused value of type org.scalatest.Assertion:s"),
Compile / console / scalacOptions ~= {
_.filterNot { opt =>
opt.startsWith("-P") || opt.startsWith("-X") || opt.startsWith("-W")
}
},
scalacOptions in (Test, console) ~= {
Test / console / scalacOptions ~= {
_.filterNot { opt =>
opt.startsWith("-P") || opt.startsWith("-X") || opt.startsWith("-W")
}
Expand All @@ -72,9 +35,9 @@ pomIncludeRepository := { _ =>

licenses := Seq("BSD-style" -> url("http://www.opensource.org/licenses/bsd-license.php"))

homepage := Some(url("https://github.com/StackVista/akka-http-pac4j"))
homepage := Some(url("https://github.com/StackVista/pekko-http-pac4j"))

scmInfo := Some(ScmInfo(url("https://github.com/StackVista/akka-http-pac4j"), "scm:git@github.com:StackVista/akka-http-pac4j.git"))
scmInfo := Some(ScmInfo(url("https://github.com/StackVista/pekko-http-pac4j"), "scm:git@github.com:StackVista/pekko-http-pac4j.git"))

developers := List(
Developer(id = "hierynomus", name = "Jeroen van Erp", email = "jeroen@hierynomus.com", url = url("https://github.com/hierynomus")),
Expand Down
13 changes: 7 additions & 6 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import sbt._

object Dependencies {
val scalacheckVersion = "1.14.3"
val akkaHttpVersion = "10.2.7"
val akkaStreamsVersion = "2.6.18"
val pekkoHttpVersion = "1.0.1"
val pekkoStreamsVersion = "1.0.3"
val pac4jVersion = "5.7.7"
val scalaTestVersion = "3.2.2"

lazy val scalacheck = "org.scalacheck" %% "scalacheck" % scalacheckVersion
lazy val akkaHttp = "com.typesafe.akka" %% "akka-http" % akkaHttpVersion
lazy val akkaHttpTestKit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion
lazy val akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaStreamsVersion
lazy val pekkoHttp = "org.apache.pekko" %% "pekko-http" % pekkoHttpVersion
lazy val pekkoHttpTestKit = "org.apache.pekko" %% "pekko-http-testkit" % pekkoHttpVersion
lazy val pekkoStream = "org.apache.pekko" %% "pekko-stream" % pekkoStreamsVersion
lazy val pac4j = "org.pac4j" % "pac4j-core" % pac4jVersion
lazy val scalaTestCore = "org.scalatest" %% "scalatest" % scalaTestVersion
lazy val akkaStreamTestKit = "com.typesafe.akka" %% "akka-stream-testkit" % akkaStreamsVersion
lazy val pekkoStreamTestKit = "org.apache.pekko" %% "pekko-stream-testkit" % pekkoStreamsVersion
lazy val scalaCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.13.0"
}
2 changes: 1 addition & 1 deletion project/Scapegoat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Scapegoat extends AutoPlugin {
import ScapegoatSbtPlugin.autoImport._

override def projectSettings = Seq(
ThisBuild / scapegoatVersion := "1.4.8",
ThisBuild / scapegoatVersion := "2.1.6",
scapegoatReports := Seq("text"), // xml in 2.13 require extra dep
scapegoatDisabledInspections := Seq("FinalModifierOnCaseClass"),
pomPostProcess := {
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=1.4.9
sbt.version=1.11.4
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.8")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.2")

addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.1.0")
addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.2.13")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.6")
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.pac4j.core.profile.UserProfile
* Class which serves as a witness when authentication was successful. This class is private such that the user of this
* library cannot mess with it.
*/
case class AuthenticatedRequest private[pac4j] (private[pac4j] val webContext: AkkaHttpWebContext,
case class AuthenticatedRequest private[pac4j] (private[pac4j] val webContext: PekkoHttpWebContext,
/*
* Profiles can be accessed such that the user can inspect data
* from the authentication. Should not be empty after authentication
Expand Down
Loading