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

Current development branch #4

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
714e3de
remove scalastyle from project.
janjaali Feb 26, 2018
90af8bb
update README.
janjaali Feb 26, 2018
478875b
remove misplaced import in build.sbt
janjaali Feb 26, 2018
e5fbe2e
initialize multi module project structure.
janjaali Feb 26, 2018
43775f1
initialize spray-jwt-akka-http-test project.
janjaali Feb 26, 2018
f3eda61
initial draft with first route for spray-jwt-akka-http-test.
janjaali Feb 26, 2018
b697107
Rename ServerRoutes to ApiRoutes.
janjaali Mar 1, 2018
e17f36b
initialize tokenRoute
janjaali Mar 1, 2018
5359e3e
impl. getting jwt token on GET /token call.
janjaali Mar 1, 2018
b76abe6
add route for secured resource.
janjaali Mar 1, 2018
9d7a07d
Update scala-version to 2.12.8.
janjaali Mar 2, 2019
80527e1
Update sbt-version to 1.2.8.
janjaali Mar 2, 2019
bed077d
Bump scala language version to v2.13.4.
janjaali Feb 21, 2021
b23138e
Bump sbt version to v1.4.5.
janjaali Feb 21, 2021
8674d3e
Add VS Code and Metals files to gitignore.
janjaali Feb 21, 2021
70e75f0
Add version scheme "early-semver" for build.
janjaali Feb 21, 2021
df09a71
Fix lib version number in build.
janjaali Feb 21, 2021
16b4c20
Update changelog format.
janjaali Feb 21, 2021
d50c8d7
Added some blank lines to README.
janjaali Feb 23, 2021
b190692
Fix code block language in README.
janjaali Feb 23, 2021
a2e0c8d
Add scalafmt and scalafix.
janjaali Mar 14, 2021
55cdd77
WIP
janjaali Mar 15, 2021
f772d63
WIP.
janjaali Mar 24, 2021
68a0cc6
WIP.
janjaali Mar 24, 2021
6c2b6b6
WIP
janjaali Apr 7, 2021
0621f1e
Update SBT version to v1.5.0.
janjaali Apr 10, 2021
4a6b708
Udpate scalafmt version to v2.7.5.
janjaali Apr 10, 2021
6876cca
WIP
janjaali Apr 11, 2021
2de49f2
WIP.
janjaali Apr 13, 2021
eba7149
WIP.
janjaali Apr 13, 2021
d68043d
WIP.
janjaali Apr 20, 2021
82ae155
WIP
janjaali Apr 20, 2021
8e2a69e
WIP.
janjaali Apr 21, 2021
df0a7bf
WIP
janjaali Apr 26, 2021
7dc93ae
WIP.
janjaali May 7, 2021
e781344
WIP.
janjaali May 7, 2021
0b48aff
WIP.
janjaali May 9, 2021
6062dc6
WIP.
janjaali May 11, 2021
24b7026
WIP.
janjaali May 11, 2021
215087f
WIP
janjaali May 11, 2021
719b5a9
WIP.
janjaali May 16, 2021
3ff2900
WIP.
janjaali May 16, 2021
ad9ebe0
WIP.
janjaali May 16, 2021
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
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

16 changes: 14 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
.idea

# Build
target
project/target

# IntelliJ
.idea

# VS Code
.vscode

# Metals
.bloop
.bsp
.metals
metals.sbt
project/project
17 changes: 17 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// https://github.com/liancheng/scalafix-organize-imports
OrganizeImports {
blankLines = Auto
coalesceToWildcardImportThreshold = 5
expandRelative = false
groupExplicitlyImportedImplicitsSeparately = false
groupedImports = Merge
groups = [
"*"
"java."
"scala."
]
importSelectorsOrder = Ascii
importsOrder = Ascii
preset = DEFAULT
removeUnused = true
}
8 changes: 8 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "3.0.0-RC2"

runner.dialect = scala3

newlines.topLevelStatements = [before]
newlines.afterCurlyLambdaParams = preserve

docstrings.wrap = "no"
25 changes: 12 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Changelog

## Version 1.0.0 (2017-11-12)
All notable changes to this project will be documented in this file.

### New features
- Encode and decode JWT token
- suppot hashing algorithms:
- - HS256
- - HS384
- - HS512
- - RS256
- - RS384
- - RS512
- - ES256
- - ES384
- - ES512
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.0]

### ✨ Feature

* Add CHANGELOG to root directory

## [1.0.0]

* Encode and decode JWT tokens support for following hashing algorithms (HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384 and ES512)
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# spray-jwt

JWT library to use with spray-json and akka-http.

## Install

Add spray-jwt as dependency to your `build.sbt`:

```sbtshell
```sbt
libraryDependencies ++= Seq(
"com.github.janjaali" %% "spray-jwt" % "1.0.0"
)
```

To encode a JsValue to a JWT token:

```scala
import org.janjaali.sprayjwt.Jwt
import org.janjaali.sprayjwt.algorithms.HS256
Expand All @@ -20,6 +23,7 @@ val jwtOpt = Jwt.encode(payload, "super_fancy_secret", HS256)
```

And vice versa to decode JWT token as a JsValue:

```scala
import org.janjaali.sprayjwt.Jwt
import org.janjaali.sprayjwt.algorithms.HS256
Expand All @@ -29,17 +33,11 @@ val jsValueOpt = Jwt.decode(token, "super_fancy_secret")
```

## Supported algorithms
- HS256
- HS384
- HS512

- RS256
- RS384
- RS512

## Source Code Style
Check style via [scalastyle](http://www.scalastyle.org/):
* HS256
* HS384
* HS512

```sbtshell
sbt scalastyle
```
* RS256
* RS384
* RS512
124 changes: 57 additions & 67 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,70 +1,60 @@
import scala.sys.process._

name := "spray-jwt"

organization := "com.github.janjaali"

version := "1.0.0"

licenses := Seq("MIT License" -> url("https://opensource.org/licenses/MIT"))

homepage := Some(url("https://github.com/janjaali/spray-jwt"))

scmInfo := Some(
ScmInfo(
url("https://github.com/janjaali/spray-jwt"),
"scm:[email protected]/janjaali/spray-jwt.git"
)
)

developers := List(
Developer(
id = "ghashange",
name = "ghashange",
email = "",
url = url("https://github.com/janjaali")
ThisBuild / scalaVersion := "3.0.0-RC3"

ThisBuild / versionScheme := Some("early-semver")

lazy val sprayJwt = (project in file("spray-jwt"))
.settings(
name := "spray-jwt",
organization := "com.github.janjaali",
version := "1.0.0",

licenses := Seq(
"MIT License" -> url("https://opensource.org/licenses/MIT")
),
homepage := Some(url("https://github.com/janjaali/spray-jwt")),
scmInfo := Some(
ScmInfo(
browseUrl = url("https://github.com/janjaali/spray-jwt"),
connection = "scm:[email protected]/janjaali/spray-jwt.git"
)
),
developers := List(
Developer(
id = "janjaali",
name = "janjaali",
email = "",
url = url("https://github.com/janjaali")
)
),

publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) {
Some("snapshots" at nexus + "content/repositories/snapshots")
} else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
},

libraryDependencies ++= Seq(
// JSON
("io.spray" %% "spray-json" % "1.3.6").cross(CrossVersion.for3Use2_13),
// Encryption
"org.bouncycastle" % "bcpkix-jdk15on" % "1.58",
// Test
"org.scalatest" %% "scalatest" % "3.2.8" % Test,
// Property based tests
"org.scalacheck" %% "scalacheck" % "1.15.3" % Test,
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.8.0" % Test
)
)
)

scalaVersion := "2.12.3"

publishMavenStyle := true

publishArtifact in Test := false

publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) {
Some("snapshots" at nexus + "content/repositories/snapshots")
} else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
lazy val sprayJsonSupport = (project in file("spray-json-support"))
.dependsOn(sprayJwt % "test->test;compile->compile")
.settings {
libraryDependencies ++= Seq(
// Supported JSON library
("io.spray" %% "spray-json" % "1.3.6").cross(CrossVersion.for3Use2_13)
)
}
}

val testDependencies = Seq(
"org.scalatest" %% "scalatest" % "3.0.4" % "test"
)

val dependencies = Seq(
"io.spray" %% "spray-json" % "1.3.3",
"org.bouncycastle" % "bcpkix-jdk15on" % "1.58"
)

libraryDependencies ++= dependencies
libraryDependencies ++= testDependencies

lazy val scalastyleTest = taskKey[Unit]("scalastyleTest")
scalastyleTest := (scalastyle in Test).toTask("").value

(scalastyle in Compile) := ((scalastyle in Compile) dependsOn scalastyleTest).toTask("").value

lazy val installGitHook = taskKey[Unit]("Installs git hooks")
installGitHook := {
if (sys.props("os.name").contains("Windows")) {
"cmd /c copy scripts\\pre-commit-hook.sh .git\\hooks\\pre-commit" !
} else {
"cp scripts/pre-commit-hook.sh .git/hooks/pre-commit" !
}
}

(compile in Compile) := ((compile in Compile) dependsOn installGitHook).value
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.0.2
sbt.version = 1.5.1
3 changes: 0 additions & 3 deletions project/plugins.sbt

This file was deleted.

98 changes: 0 additions & 98 deletions scalastyle-config.xml

This file was deleted.

Loading