Skip to content

Commit 35b224e

Browse files
committed
Merge branch 'master' of https://github.com/auth0/java-jwt
# Conflicts: # lib/build.gradle # lib/src/main/java/com/auth0/jwt/impl/JsonNodeClaim.java
2 parents a068526 + 5dbe4e8 commit 35b224e

57 files changed

Lines changed: 2301 additions & 1083 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.circleci/config.yml‎

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,6 @@
11
version: 2
22
jobs:
3-
java_7_build:
4-
docker:
5-
- image: openjdk:7u121-jdk
6-
steps:
7-
- checkout
8-
- run: chmod +x gradlew
9-
# Download and cache dependencies
10-
- restore_cache:
11-
keys:
12-
- v1-dependencies-{{ checksum "build.gradle" }}
13-
# fallback to using the latest cache if no exact match is found
14-
- v1-dependencies-
15-
# run tests!
16-
- run: ./gradlew clean check jacocoTestReport --continue --console=plain
17-
- run:
18-
name: Upload Coverage
19-
when: on_success
20-
command: bash <(curl -s https://codecov.io/bash)
21-
- save_cache:
22-
paths:
23-
- ~/.m2
24-
key: v1-dependencies-{{ checksum "build.gradle" }}
25-
environment:
26-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
27-
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
28-
TERM: dumb
29-
30-
java_8_build:
3+
build:
314
docker:
325
- image: openjdk:8-jdk
336
steps:
@@ -44,7 +17,7 @@ jobs:
4417
- run:
4518
name: Upload Coverage
4619
when: on_success
47-
command: bash <(curl -s https://codecov.io/bash)
20+
command: bash <(curl -s https://codecov.io/bash) -Z -C $CIRCLE_SHA1
4821
- save_cache:
4922
paths:
5023
- ~/.m2
@@ -53,10 +26,3 @@ jobs:
5326
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
5427
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
5528
TERM: dumb
56-
57-
workflows:
58-
version: 2
59-
build:
60-
jobs:
61-
- java_7_build
62-
- java_8_build

‎.codecov.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ coverage:
55
status:
66
patch:
77
default:
8-
if_no_uploads: error
8+
if_no_uploads: success
9+
if_ci_failed: error
910
changes: true
1011
project:
1112
default:

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @auth0/dx-sdks-approver

‎.github/ISSUE_TEMPLATE.md‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
In order to efficiently and accurately address your issue or feature request, please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. Please delete any sections or questions below that do not pertain to this request.
2+
3+
For general support or usage questions, please use the [Auth0 Community](https://community.auth0.com/) or [Auth0 Support](https://support.auth0.com/).
4+
5+
### Description
6+
7+
Description of the bug or feature request and why it's a problem. Consider including:
8+
9+
- The use case or overall problem you're trying to solve
10+
- Information about when the problem started
11+
12+
### Prerequisites
13+
14+
- [ ] I have checked the documentation for this library in the README.
15+
- [ ] I have checked the [Auth0 Community](https://community.auth0.com/) for related posts.
16+
- [ ] I have checked for related or duplicate [Issues](https://github.com/auth0/java-jwt/issues) and [PRs](https://github.com/auth0/java-jwt/pulls).
17+
- [ ] I have read the [Auth0 general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md).
18+
- [ ] I have read the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md).
19+
- [ ] I am reporting this to the correct repository (note this library is used by many libraries, such as [auth0-java](https://github.com/auth0/auth0-java)).
20+
21+
### Environment
22+
23+
Please provide the following:
24+
25+
- Version of this library used:
26+
- Version of Java framework used:
27+
- Additional libraries that might be affecting your instance:
28+
29+
### Reproduction
30+
31+
Detail the steps taken to reproduce this error and note if this issue can be reproduced consistently or if it is intermittent.
32+
33+
Please include:
34+
35+
- Code sample to reproduce the issue
36+
- Log files (redact/remove sensitive information)
37+
- Application settings (redact/remove sensitive information)
38+
- Screenshots, if helpful

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
### Changes
2+
3+
Please describe both what is changing and why this is important. Include:
4+
5+
- Endpoints added, deleted, deprecated, or changed
6+
- Classes and methods added, deleted, deprecated, or changed
7+
- Screenshots of new or changed UI, if applicable
8+
- A summary of usage if this is a new feature or change to a public API (this should also be added to relevant documentation once released)
9+
- Any alternative designs or approaches considered
10+
11+
### References
12+
13+
Please include relevant links supporting this change such as a:
14+
15+
- support ticket
16+
- community post
17+
- StackOverflow post
18+
- support forum thread
19+
20+
### Testing
21+
22+
Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.
23+
24+
- [ ] This change adds test coverage
25+
- [ ] This change has been tested on the latest version of Java or why not
26+
27+
### Checklist
28+
29+
- [ ] I have read the [Auth0 general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
30+
- [ ] I have read the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
31+
- [ ] All existing and new tests complete without errors

‎.github/stale.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
daysUntilStale: 90
5+
6+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7+
daysUntilClose: 7
8+
9+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
10+
exemptLabels: []
11+
12+
# Set to true to ignore issues with an assignee (defaults to false)
13+
exemptAssignees: true
14+
15+
# Label to use when marking as stale
16+
staleLabel: closed:stale
17+
18+
# Comment to post when marking as stale. Set to `false` to disable
19+
markComment: >
20+
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Temporary Items
4141
## Plugin-specific files:
4242

4343
# IntelliJ
44+
bin/
4445
/out/
4546
/lib/out/
4647

‎CHANGELOG.md‎

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,123 @@
11
# Change Log
22

3+
## [3.10.3](https://github.com/auth0/java-jwt/tree/3.10.3) (2020-04-24)
4+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.10.2...3.10.3)
5+
6+
**Fixed**
7+
- Fixed an NPE on null map and list claims [\#417](https://github.com/auth0/java-jwt/pull/417) ([Vorotyntsev](https://github.com/Vorotyntsev))
8+
9+
## [3.10.2](https://github.com/auth0/java-jwt/tree/3.10.2) (2020-03-27)
10+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.10.1...3.10.2)
11+
12+
**Fixed**
13+
- JavaDoc fix [\#413](https://github.com/auth0/java-jwt/pull/413) ([jimmyjames](https://github.com/jimmyjames))
14+
- Check varargs null values in JWTVerifier [\#412](https://github.com/auth0/java-jwt/pull/412) ([jimmyjames](https://github.com/jimmyjames))
15+
16+
## [3.10.1](https://github.com/auth0/java-jwt/tree/3.10.1) (2020-03-13)
17+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.10.0...3.10.1)
18+
19+
**Changed**
20+
- Update Jackson and Commons Codec dependencies [\#407](https://github.com/auth0/java-jwt/pull/407) ([jimmyjames](https://github.com/jimmyjames))
21+
22+
**Security**
23+
- Update jackson-databind to 2.10.2 [\#399](https://github.com/auth0/java-jwt/pull/399) ([gexclaude](https://github.com/gexclaude))
24+
25+
## [3.10.0](https://github.com/auth0/java-jwt/tree/3.10.0) (2020-02-14)
26+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.9.0...3.10.0)
27+
**Closed issues**
28+
- NullPointerException when the claim doesn't exist in the token [\#384](https://github.com/auth0/java-jwt/issues/384)
29+
30+
**Added**
31+
- Add Javadoc URL and badge to the README [\#382](https://github.com/auth0/java-jwt/pull/382) ([lbalmaceda](https://github.com/lbalmaceda))
32+
- Allow to customize the typ header claim [\#381](https://github.com/auth0/java-jwt/pull/381) ([lbalmaceda](https://github.com/lbalmaceda))
33+
- JWTCreator for basic types [\#282](https://github.com/auth0/java-jwt/pull/282) ([skjolber](https://github.com/skjolber))
34+
- Support verification of Long[] datatype like in JWTCreator [\#278](https://github.com/auth0/java-jwt/pull/278) ([skjolber](https://github.com/skjolber))
35+
36+
**Changed**
37+
- Update to Gradle 6.1.1 [\#389](https://github.com/auth0/java-jwt/pull/389) ([jimmyjames](https://github.com/jimmyjames))
38+
39+
**Fixed**
40+
- Handle missing expected array claim [\#393](https://github.com/auth0/java-jwt/pull/393) ([lbalmaceda](https://github.com/lbalmaceda))
41+
- Update tests to use valid Base64 URL-encoded tokens [\#386](https://github.com/auth0/java-jwt/pull/386) ([jimmyjames](https://github.com/jimmyjames))
42+
43+
## [3.9.0](https://github.com/auth0/java-jwt/tree/3.9.0) (2020-01-02)
44+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.8.3...3.9.0)
45+
46+
**Added**
47+
- Support serialization of DecodedJWT [\#370](https://github.com/auth0/java-jwt/pull/370) ([jimmyjames](https://github.com/jimmyjames))
48+
49+
**Fixed**
50+
- Fixing JwtCreator builder when setting headers as a map [\#320](https://github.com/auth0/java-jwt/pull/320) ([maxbalan](https://github.com/maxbalan))
51+
52+
## [3.8.3](https://github.com/auth0/java-jwt/tree/3.8.3) (2019-09-25)
53+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.8.2...3.8.3)
54+
55+
**Security**
56+
- Fix: updated jackson-databind to 2.10.0.pr3 to block CVE [\#356](https://github.com/auth0/java-jwt/pull/356) ([danbrodsky](https://github.com/danbrodsky))
57+
58+
## [3.8.2](https://github.com/auth0/java-jwt/tree/3.8.2) (2019-08-15)
59+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.8.1...3.8.2)
60+
61+
**Security**
62+
- Fix: updated jackson-databind to 2.9.9.3 to block CVE [\#347](https://github.com/auth0/java-jwt/pull/347) ([danbrodsky](https://github.com/danbrodsky))
63+
64+
## [3.8.1](https://github.com/auth0/java-jwt/tree/3.8.1) (2019-05-22)
65+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.8.0...3.8.1)
66+
67+
**Security**
68+
- Bump dependencies and fix security issue [\#337](https://github.com/auth0/java-jwt/pull/337) ([lbalmaceda](https://github.com/lbalmaceda))
69+
70+
## [3.8.0](https://github.com/auth0/java-jwt/tree/3.8.0) (2019-03-14)
71+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.7.0...3.8.0)
72+
73+
**Added**
74+
- Support multiple issuers #246 [\#288](https://github.com/auth0/java-jwt/pull/288) ([itdevelopmentapps](https://github.com/itdevelopmentapps))
75+
76+
## [3.7.0](https://github.com/auth0/java-jwt/tree/3.7.0) (2019-01-29)
77+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.6.0...3.7.0)
78+
79+
**Added**
80+
- Performance improvements [\#255](https://github.com/auth0/java-jwt/pull/255) ([skjolber](https://github.com/skjolber))
81+
82+
## [3.6.0](https://github.com/auth0/java-jwt/tree/3.6.0) (2019-01-24)
83+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.5.0...3.6.0)
84+
85+
**Added**
86+
- Allow to skip "issued at" validation [\#297](https://github.com/auth0/java-jwt/pull/297) ([complanboy2](https://github.com/complanboy2))
87+
88+
## [3.5.0](https://github.com/auth0/java-jwt/tree/3.5.0) (2019-01-03)
89+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.4.1...3.5.0)
90+
91+
**Added**
92+
- Verify a DecodedJWT [\#308](https://github.com/auth0/java-jwt/pull/308) ([martinoconnor](https://github.com/martinoconnor))
93+
94+
**Changed**
95+
- Add an interface for JWTVerifier. [\#205](https://github.com/auth0/java-jwt/pull/205) ([jebbench](https://github.com/jebbench))
96+
97+
**Fixed**
98+
- Remove unnecessary cast between long/double and floor call [\#296](https://github.com/auth0/java-jwt/pull/296) ([jhorstmann](https://github.com/jhorstmann))
99+
100+
**Security**
101+
- Bump jackson-databind to patch security issues [\#309](https://github.com/auth0/java-jwt/pull/309) ([lbalmaceda](https://github.com/lbalmaceda))
102+
103+
## [3.4.1](https://github.com/auth0/java-jwt/tree/3.4.1) (2018-10-24)
104+
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.4.0...3.4.1)
105+
106+
**Security**
107+
- Update jackson-databind dependency [\#292](https://github.com/auth0/java-jwt/pull/292) ([lbalmaceda](https://github.com/lbalmaceda))
108+
3109
## [3.4.0](https://github.com/auth0/java-jwt/tree/3.4.0) (2018-06-13)
4110
[Full Changelog](https://github.com/auth0/java-jwt/compare/3.3.0...3.4.0)
5111

112+
**Breaking Changes**
113+
- Fix for [\#236](https://github.com/auth0/java-jwt/pull/236) - refactored HMACAlgorithm so that it doesn't throw an UnsupportedEncodingException [\#242](https://github.com/auth0/java-jwt/pull/242) ([obecker](https://github.com/obecker)).
114+
115+
Clients using the following methods may need to update their code to not catch an `UnsupportedEncodingException`:
116+
- `public static Algorithm HMAC384(String secret)`
117+
- `public static Algorithm HMAC256(String secret)`
118+
- `public static Algorithm HMAC512(String secret)`
119+
6120
**Changed**
7-
- Fix for issue #236 - refactored HMACAlgorithm so that it doesn't throw an UnsupportedEncodingException [\#242](https://github.com/auth0/java-jwt/pull/242) ([obecker](https://github.com/obecker))
8121
- Throw JWTDecodeException when date claim format is invalid [\#241](https://github.com/auth0/java-jwt/pull/241) ([lbalmaceda](https://github.com/lbalmaceda))
9122

10123
**Security**

‎README.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,32 @@
33
# Java JWT
44

55
[![CircleCI](https://img.shields.io/circleci/project/github/auth0/java-jwt.svg?style=flat-square)](https://circleci.com/gh/auth0/java-jwt/tree/master)
6-
[![Coverage Status](https://img.shields.io/codecov/c/github/auth0/java-jwt/v3.svg?style=flat-square)](https://codecov.io/github/auth0/java-jwt)
6+
[![Coverage Status](https://img.shields.io/codecov/c/github/auth0/java-jwt.svg?style=flat-square)](https://codecov.io/github/auth0/java-jwt)
77
[![License](http://img.shields.io/:license-mit-blue.svg?style=flat)](http://doge.mit-license.org)
8+
[![Javadoc](https://javadoc.io/badge2/com.auth0/java-jwt/javadoc.svg)](https://javadoc.io/doc/com.auth0/java-jwt/latest/index.html)
89

910
A Java implementation of [JSON Web Token (JWT) - RFC 7519](https://tools.ietf.org/html/rfc7519).
1011

1112
If you're looking for an **Android** version of the JWT Decoder take a look at our [JWTDecode.Android](https://github.com/auth0/JWTDecode.Android) library.
1213

1314
## Installation
1415

16+
The library is available on both Maven Central and Bintray, and the Javadoc is published [here](https://javadoc.io/doc/com.auth0/java-jwt/latest/index.html).
17+
1518
### Maven
1619

1720
```xml
1821
<dependency>
1922
<groupId>com.auth0</groupId>
2023
<artifactId>java-jwt</artifactId>
21-
<version>3.4.0</version>
24+
<version>3.10.3</version>
2225
</dependency>
2326
```
2427

2528
### Gradle
2629

2730
```gradle
28-
compile 'com.auth0:java-jwt:3.4.0'
31+
implementation 'com.auth0:java-jwt:3.10.3'
2932
```
3033

3134
## Available Algorithms
@@ -65,6 +68,8 @@ RSAPrivateKey privateKey = //Get the key instance
6568
Algorithm algorithmRS = Algorithm.RSA256(publicKey, privateKey);
6669
```
6770

71+
> Note: How you obtain or read keys is not in the scope of this library. For an example of how you might implement this, see [this gist](https://gist.github.com/lbalmaceda/9a0c7890c2965826c04119dcfb1a5469).
72+
6873
#### Using a KeyProvider:
6974

7075
By using a `KeyProvider` you can change in runtime the key used either to verify the token signature or to sign a new token for RSA or ECDSA algorithms. This is achieved by implementing either `RSAKeyProvider` or `ECDSAKeyProvider` methods:
@@ -74,8 +79,7 @@ By using a `KeyProvider` you can change in runtime the key used either to verify
7479
- `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`.
7580

7681

77-
The following snippet uses example classes showing how this would work:
78-
82+
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.
7983

8084
```java
8185
final JwkStore jwkStore = new JwkStore("{JWKS_FILE_HOST}");
@@ -105,9 +109,6 @@ Algorithm algorithm = Algorithm.RSA256(keyProvider);
105109
//Use the Algorithm to create and verify JWTs.
106110
```
107111

108-
> For simple key rotation using JWKs try the [jwks-rsa-java](https://github.com/auth0/jwks-rsa-java) library.
109-
110-
111112
### Create and Sign a Token
112113

113114
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.
@@ -187,7 +188,7 @@ If the token has an invalid signature or the Claim requirement is not met, a `JW
187188
The JWT token may include DateNumber fields that can be used to validate that:
188189
* The token was issued in a past date `"iat" < TODAY`
189190
* The token hasn't expired yet `"exp" > TODAY` and
190-
* The token can already be used. `"nbf" > TODAY`
191+
* The token can already be used. `"nbf" < TODAY`
191192

192193
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.
193194

‎build.gradle‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

3-
buildscript {
4-
repositories {
5-
jcenter()
6-
}
7-
dependencies {
8-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1'
9-
}
10-
}
11-
123
allprojects {
134
group = 'com.auth0'
14-
155
repositories {
166
jcenter()
177
}

0 commit comments

Comments
 (0)