Skip to content

Commit

Permalink
Merge branch 'master' into issue254
Browse files Browse the repository at this point in the history
  • Loading branch information
veerasekharbab.golla committed Jan 12, 2019
2 parents 39ec032 + c361fdb commit 8dbfbc1
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 432 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
version: 2
jobs:
build:
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
TERM: dumb
docker:
- image: openjdk:8-jdk
steps:
Expand All @@ -21,8 +17,12 @@ jobs:
- run:
name: Upload Coverage
when: on_success
command: bash <(curl -s https://codecov.io/bash)
command: bash <(curl -s https://codecov.io/bash) -Z -C $CIRCLE_SHA1
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "build.gradle" }}
key: v1-dependencies-{{ checksum "build.gradle" }}
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
TERM: dumb
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Temporary Items
## Plugin-specific files:

# IntelliJ
bin/
/out/
/lib/out/

Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Change Log

## [3.5.0](https://github.com/auth0/java-jwt/tree/3.5.0) (2019-01-03)
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.4.1...3.5.0)

**Added**
- Verify a DecodedJWT [\#308](https://github.com/auth0/java-jwt/pull/308) ([martinoconnor](https://github.com/martinoconnor))

**Changed**
- Add an interface for JWTVerifier. [\#205](https://github.com/auth0/java-jwt/pull/205) ([jebbench](https://github.com/jebbench))

**Fixed**
- Remove unnecessary cast between long/double and floor call [\#296](https://github.com/auth0/java-jwt/pull/296) ([jhorstmann](https://github.com/jhorstmann))

**Security**
- Bump jackson-databind to patch security issues [\#309](https://github.com/auth0/java-jwt/pull/309) ([lbalmaceda](https://github.com/lbalmaceda))

## [3.4.1](https://github.com/auth0/java-jwt/tree/3.4.1) (2018-10-24)
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.4.0...3.4.1)

**Security**
- Update jackson-databind dependency [\#292](https://github.com/auth0/java-jwt/pull/292) ([lbalmaceda](https://github.com/lbalmaceda))

## [3.4.0](https://github.com/auth0/java-jwt/tree/3.4.0) (2018-06-13)
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.3.0...3.4.0)

Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ If you're looking for an **Android** version of the JWT Decoder take a look at o
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.4.0</version>
<version>3.5.0</version>
</dependency>
```

### Gradle

```gradle
compile 'com.auth0:java-jwt:3.4.0'
implementation 'com.auth0:java-jwt:3.5.0'
```

## Available Algorithms
Expand Down Expand Up @@ -74,8 +74,7 @@ By using a `KeyProvider` you can change in runtime the key used either to verify
- `getPrivateKeyId()`: Its called during token signing and it should return the id of the key that identifies the one returned by `getPrivateKey()`. This value is preferred over the one set in the `JWTCreator.Builder#withKeyId(String)` method. If you don't need to set a `kid` value avoid instantiating an Algorithm using a `KeyProvider`.


The following snippet uses example classes showing how this would work:

The following example shows how this would work with `JwkStore`, an imaginary [JWK Set](https://auth0.com/docs/jwks) implementation. For simple key rotation using JWKS, try the [jwks-rsa-java](https://github.com/auth0/jwks-rsa-java) library.

```java
final JwkStore jwkStore = new JwkStore("{JWKS_FILE_HOST}");
Expand Down Expand Up @@ -105,9 +104,6 @@ Algorithm algorithm = Algorithm.RSA256(keyProvider);
//Use the Algorithm to create and verify JWTs.
```

> For simple key rotation using JWKs try the [jwks-rsa-java](https://github.com/auth0/jwks-rsa-java) library.

### Create and Sign a Token

You'll first need to create a `JWTCreator` instance by calling `JWT.create()`. Use the builder to define the custom Claims your token needs to have. Finally to get the String token call `sign()` and pass the `Algorithm` instance.
Expand Down Expand Up @@ -187,7 +183,7 @@ If the token has an invalid signature or the Claim requirement is not met, a `JW
The JWT token may include DateNumber fields that can be used to validate that:
* The token was issued in a past date `"iat" < TODAY`
* The token hasn't expired yet `"exp" > TODAY` and
* The token can already be used. `"nbf" > TODAY`
* The token can already be used. `"nbf" < TODAY`

When verifying a token the time validation occurs automatically, resulting in a `JWTVerificationException` being throw when the values are invalid. If any of the previous fields are missing they won't be considered in this validation.

Expand Down
9 changes: 0 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1'
}
}

allprojects {
group = 'com.auth0'

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
72 changes: 42 additions & 30 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -85,7 +89,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand Down Expand Up @@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
14 changes: 4 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down
65 changes: 30 additions & 35 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
apply plugin: 'jacoco'
apply plugin: 'java'
apply from: '../scripts/release.gradle'
apply from: '../scripts/maven.gradle'
apply from: '../scripts/bintray.gradle'
plugins {
id "com.jfrog.bintray" version "1.8.4"
id "com.auth0.gradle.oss-library.java" version "0.8.0"
id "jacoco"
}

logger.lifecycle("Using version ${version} for ${group}.${name}")

auth0 {
oss {
name "java jwt"
repo "java-jwt"
repository "java-jwt"
organization "auth0"
description "Java implementation of JSON Web Token (JWT)"
url 'http://www.jwt.io'
developer {
id = "auth0"
name = "Auth0"
email = "[email protected]"
}
developer {
id = "lbalmaceda"
name = "Luciano Balmaceda"
email = "[email protected]"
}
developer {
id = "hzalaz"
name = "Hernan Zalazar"
email = "[email protected]"

developers {
auth0 {
displayName = "Auth0"
email = "[email protected]"
}
lbalmaceda {
displayName = "Luciano Balmaceda"
email = "[email protected]"
}
hzalaz {
displayName = "Hernan Zalazar"
email = "[email protected]"
}
}
}

Expand All @@ -34,13 +34,13 @@ compileJava {
}

dependencies {
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.6'
compile 'commons-codec:commons-codec:1.11'
testCompile 'org.bouncycastle:bcprov-jdk15on:1.59'
testCompile 'junit:junit:4.12'
testCompile 'net.jodah:concurrentunit:0.4.3'
testCompile 'org.hamcrest:java-hamcrest:2.0.0.0'
testCompile 'org.mockito:mockito-core:2.18.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
implementation 'commons-codec:commons-codec:1.11'
testImplementation 'org.bouncycastle:bcprov-jdk15on:1.59'
testImplementation 'junit:junit:4.12'
testImplementation 'net.jodah:concurrentunit:0.4.3'
testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0'
testImplementation 'org.mockito:mockito-core:2.18.3'
}

jacocoTestReport {
Expand All @@ -55,9 +55,4 @@ test {
events "skipped", "failed", "standardError"
exceptionFormat "short"
}
}

task clean(type: Delete) {
delete rootProject.buildDir
delete 'CHANGELOG.md.release'
}
}
Loading

0 comments on commit 8dbfbc1

Please sign in to comment.