Skip to content

Commit 962af17

Browse files
Merge pull request #2 from BastiaanJansen/dev
Bufixes, minor improvements and new unit tests
2 parents 3e49530 + 15f792f commit 962af17

File tree

19 files changed

+1192
-497
lines changed

19 files changed

+1192
-497
lines changed

.github/workflows/build.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build & Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
name: Java ${{ matrix.java }} build
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
java: [ 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ]
16+
steps:
17+
- name: Checkout source code
18+
uses: actions/checkout@v2
19+
- name: Set up JDK
20+
uses: actions/setup-java@v1
21+
with:
22+
java-package: jdk
23+
java-version: ${{ matrix.java }}
24+
- name: Build with Maven
25+
run: mvn -B package --file pom.xml
26+
- run: mkdir artifacts && cp target/*.jar artifacts
27+
- name: Upload Maven build artifact
28+
uses: actions/upload-artifact@v2
29+
with:
30+
name: artifact-java-${{ matrix.java }}.jar
31+
path: artifacts
32+
33+
test:
34+
name: Java ${{ matrix.java }} test
35+
needs: [build]
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
java: [ 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ]
40+
steps:
41+
- name: Checkout the repository
42+
uses: actions/checkout@v2
43+
- name: Set up JDK
44+
uses: actions/setup-java@v1
45+
with:
46+
java-version: ${{ matrix.java }}
47+
- name: Run tests with Maven
48+
run: mvn -B test --file pom.xml
49+
50+
codeql:
51+
name: CodeQL Analyze
52+
needs: [ build ]
53+
runs-on: ubuntu-latest
54+
permissions:
55+
actions: read
56+
contents: read
57+
security-events: write
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
language: [ 'java' ]
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v2
65+
- name: Initialize CodeQL
66+
uses: github/codeql-action/init@v1
67+
with:
68+
languages: ${{ matrix.language }}
69+
- name: Autobuild
70+
uses: github/codeql-action/autobuild@v1
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v1
73+
74+
# lint:
75+
# name: Linter
76+
# needs: [ build ]
77+
# runs-on: ubuntu-latest
78+
# steps:
79+
# - name: Checkout source code
80+
# uses: actions/checkout@v2
81+
# - name: Lint Codebase
82+
# uses: github/super-linter/slim@v4
83+
# env:
84+
# VALIDATE_ALL_CODEBASE: false
85+
# DEFAULT_BRANCH: main
86+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/maven-publish.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/maven.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Maven Package
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
java: [ 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ]
13+
name: Java ${{ matrix.java }} build
14+
steps:
15+
- name: Checkout source code
16+
uses: actions/checkout@v2
17+
- name: Set up JDK
18+
uses: actions/setup-java@v1
19+
with:
20+
java-package: jdk
21+
java-version: ${{ matrix.java }}
22+
- name: Build with Maven
23+
run: mvn -B package --file pom.xml
24+
- run: mkdir artifacts && cp target/*.jar artifacts
25+
- name: Upload Maven build artifact
26+
uses: actions/upload-artifact@v2
27+
with:
28+
name: build-java-${{ matrix.java }}.jar
29+
path: artifacts
30+
31+
test:
32+
needs: [ build ]
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
java: [ 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ]
37+
name: Java ${{ matrix.java }} test
38+
steps:
39+
- name: Checkout the repository
40+
uses: actions/checkout@v2
41+
- name: Set up JDK
42+
uses: actions/setup-java@v1
43+
with:
44+
java-version: ${{ matrix.java }}
45+
- name: Run tests with Maven
46+
run: mvn -B test --file pom.xml
47+
48+
publish-maven-central:
49+
name: Publish to Maven Central Repository
50+
needs: [ build, test ]
51+
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
packages: write
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: Set up Java
58+
uses: actions/setup-java@v2
59+
with:
60+
java-version: '11'
61+
distribution: 'adopt'
62+
- name: Publish package
63+
uses: samuelmeuli/action-maven-publish@v1
64+
with:
65+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
66+
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
67+
nexus_username: ${{ secrets.NEXUS_USERNAME }}
68+
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
69+
maven_profiles: "deploy-maven-central"
70+
71+
publish-github-registry:
72+
name: Publish to GitHub Registry
73+
needs: [ build, test ]
74+
runs-on: ubuntu-latest
75+
permissions:
76+
contents: read
77+
packages: write
78+
steps:
79+
- uses: actions/checkout@v2
80+
- uses: actions/setup-java@v2
81+
with:
82+
server-id: github
83+
java-version: '11'
84+
distribution: 'adopt'
85+
- name: Publish package
86+
run: mvn --batch-mode --activate-profiles "deploy-github-registry" deploy
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# JWT-Java
22

3-
![](https://github./BastiaanJansen/JWT-Java/workflows/Build/badge.svg)
4-
![](https://github.com/BastiaanJansen/JWT-Java/workflows/Test/badge.svg)
3+
[![Build & Test](https://github.com/BastiaanJansen/jwt-java/actions/workflows/build.yml/badge.svg)](https://github.com/BastiaanJansen/jwt-java/actions/workflows/build.yml)
54
![](https://img.shields.io/github/license/BastiaanJansen/JWT-Java)
65
![](https://img.shields.io/github/issues/BastiaanJansen/JWT-Java)
76

@@ -80,13 +79,13 @@ To create the signature part you have to take the Base64URL encoded header, the
8079
<dependency>
8180
<groupId>com.github.bastiaanjansen</groupId>
8281
<artifactId>jwt-java</artifactId>
83-
<version>1.0</version>
82+
<version>1.1</version>
8483
</dependency>
8584
```
8685

8786
### Gradle
8887
```gradle
89-
implementation 'com.github.bastiaanjansen:jwt-java:1.0'
88+
implementation 'com.github.bastiaanjansen:jwt-java:1.1'
9089
```
9190

9291
## Usage
@@ -211,7 +210,7 @@ String[] audience = payload.getAudience();
211210

212211
Object customClaim = payload.get("username");
213212

214-
boolean hasClaim = payload.containsKey("key");
213+
boolean hasClaim = payload.containsClaim("key");
215214
```
216215

217216
### Validating JWT's

0 commit comments

Comments
 (0)