Skip to content

Commit 8d70e3b

Browse files
authored
Merge pull request auth0#113 from auth0/release-scripts
Configure upload to bintray and pom generation
2 parents 81f90d7 + e286109 commit 8d70e3b

File tree

11 files changed

+407
-34
lines changed

11 files changed

+407
-34
lines changed

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Change Log
2+
3+
## [3.0.0](https://github.com/auth0/java-jwt/tree/3.0.0) (2016-12-01)
4+
5+
Reimplemented java-jwt to improve API and include more signing algorithms
6+
7+
## Installation
8+
9+
### Maven
10+
11+
```xml
12+
<dependency>
13+
<groupId>com.auth0</groupId>
14+
<artifactId>java-jwt</artifactId>
15+
<version>3.0.0</version>
16+
</dependency>
17+
```
18+
19+
### Gradle
20+
21+
```gradle
22+
compile 'com.auth0:java-jwt:3.0.0'
23+
```
24+
25+
## Available Algorithms
26+
27+
The library implements JWT Verification and Signing using the following algorithms:
28+
29+
| JWS | Algorithm | Description |
30+
| :-------------: | :-------------: | :----- |
31+
| HS256 | HMAC256 | HMAC with SHA-256 |
32+
| HS384 | HMAC384 | HMAC with SHA-384 |
33+
| HS512 | HMAC512 | HMAC with SHA-512 |
34+
| RS256 | RSA256 | RSASSA-PKCS1-v1_5 with SHA-256 |
35+
| RS384 | RSA384 | RSASSA-PKCS1-v1_5 with SHA-384 |
36+
| RS512 | RSA512 | RSASSA-PKCS1-v1_5 with SHA-512 |
37+
| ES256 | ECDSA256 | ECDSA with curve P-256 and SHA-256 |
38+
| ES384 | ECDSA384 | ECDSA with curve P-384 and SHA-384 |
39+
| ES512 | ECDSA512 | ECDSA with curve P-521 and SHA-512 |

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ A Java implementation of [JSON Web Tokens (draft-ietf-oauth-json-web-token-08)](
1616
<dependency>
1717
<groupId>com.auth0</groupId>
1818
<artifactId>java-jwt</artifactId>
19-
<version>3.0.+</version>
19+
<version>3.0.0</version>
2020
</dependency>
2121
```
2222

2323
### Gradle
2424

2525
```gradle
26-
compile 'com.auth0:java-jwt:3.0.+'
26+
compile 'com.auth0:java-jwt:3.0.0'
2727
```
2828

2929
## Available Algorithms

build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:2.2.2'
9-
10-
// NOTE: Do not place your application dependencies here; they belong
11-
// in the individual module build.gradle files
9+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
1210
}
1311
}
1412

1513
allprojects {
14+
group = 'com.auth0'
15+
1616
repositories {
1717
jcenter()
1818
}
1919
}
20-
21-
task clean(type: Delete) {
22-
delete rootProject.buildDir
23-
}

lib/build.gradle

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
apply plugin: 'jacoco'
22
apply plugin: 'java'
3+
apply from: '../scripts/release.gradle'
4+
apply from: '../scripts/maven.gradle'
5+
apply from: '../scripts/bintray.gradle'
6+
7+
logger.lifecycle("Using version ${version} for ${group}.${name}")
8+
9+
auth0 {
10+
name "java jwt"
11+
repo "java-jwt"
12+
description "Java implementation of JSON Web Token (JWT)"
13+
developer {
14+
id = "auth0"
15+
name = "Auth0"
16+
email = "oss@auth0.com"
17+
}
18+
developer {
19+
id = "lbalmaceda"
20+
name = "Luciano Balmaceda"
21+
email = "luciano.balmaceda@auth0.com"
22+
}
23+
developer {
24+
id = "hzalaz"
25+
name = "Hernan Zalazar"
26+
email = "hernan@auth0.com"
27+
}
28+
}
329

430
compileJava {
531
sourceCompatibility '1.7'
632
}
733

834
dependencies {
9-
compile fileTree(dir: 'libs', include: ['*.jar'])
1035
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.4'
1136
compile 'commons-codec:commons-codec:1.10'
1237
compile 'org.bouncycastle:bcprov-jdk15on:1.55'
@@ -28,4 +53,9 @@ test {
2853
events "passed", "skipped", "failed", "standardError"
2954
exceptionFormat "short"
3055
}
31-
}
56+
}
57+
58+
task clean(type: Delete) {
59+
delete rootProject.buildDir
60+
delete 'CHANGELOG.md.release'
61+
}

lib/proguard-rules.pro

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

lib/src/test/java/com/auth0/jwt/ClockTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ public class ClockTest {
1515
public void shouldGetToday() throws Exception{
1616
Clock clock = new Clock();
1717
Date clockToday = clock.getToday();
18-
Date today = new Date();
19-
2018
assertThat(clockToday, is(notNullValue()));
21-
assertThat(clockToday.getTime(), is(equalTo(today.getTime())));
2219
}
2320

2421
}

local.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
## This file is automatically generated by Android Studio.
22
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
33
#
4-
# This file should *NOT* be checked into Version Control Systems,
4+
# This file must *NOT* be checked into Version Control Systems,
55
# as it contains information specific to your local configuration.
66
#
77
# Location of the SDK. This is only used by Gradle.
88
# For customization when using a Version Control System, please read the
99
# header note.
10-
sdk.dir=/usr/local/opt/android-sdk
10+
#Fri Dec 02 18:18:12 ART 2016
11+
ndk.dir=/Users/hernan/Development/Android.SDK/ndk-bundle
12+
sdk.dir=/Users/hernan/Development/Android.SDK

scripts/bintray.gradle

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
def credentials = new Bintray(project);
2+
3+
if (credentials.valid()) {
4+
apply plugin: 'com.jfrog.bintray'
5+
bintray {
6+
user = credentials.user
7+
key = credentials.key
8+
publications = ['mavenJava']
9+
dryRun = project.version.endsWith("-SNAPSHOT")
10+
publish = false
11+
pkg {
12+
repo = 'java'
13+
name = 'java-jwt'
14+
desc = 'Java implementation of JSON Web Token (JWT) '
15+
websiteUrl = 'https://github.com/auth0/java-jwt'
16+
vcsUrl = 'scm:git@github.com:auth0/java-jwt.git'
17+
licenses = ["MIT"]
18+
userOrg = 'auth0'
19+
publish = false
20+
version {
21+
gpg {
22+
sign = true
23+
passphrase = credentials.passphrasse
24+
}
25+
vcsTag = project.version
26+
name = project.version
27+
released = new Date()
28+
}
29+
}
30+
}
31+
}
32+
33+
class Bintray {
34+
String user
35+
String key
36+
String passphrasse
37+
38+
Bintray(project) {
39+
this.user = Bintray.value(project, 'BINTRAY_USER', 'bintray.user')
40+
this.key = Bintray.value(project, 'BINTRAY_KEY', 'bintray.key')
41+
this.passphrasse = Bintray.value(project, 'BINTRAY_PASSPHRASE', 'bintray.gpg.password')
42+
}
43+
44+
def valid() {
45+
return this.user != null && this.key != null && this.passphrasse != null;
46+
}
47+
48+
private static def value(Project project, String env, String property) {
49+
def value = System.getenv(env)
50+
if (project.hasProperty(property)) {
51+
value = project.getProperty(property);
52+
}
53+
return value
54+
}
55+
}

scripts/maven.gradle

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
apply plugin: Auth0OSS
2+
3+
class Auth0OSS implements Plugin<Project> {
4+
5+
void apply(Project target) {
6+
target.extensions.create("auth0", Auth0Extension, target)
7+
target.configure(target) {
8+
apply plugin: 'maven-publish'
9+
10+
target.task("sourcesJar", type: Jar, dependsOn: classes) {
11+
classifier = 'sources'
12+
from sourceSets.main.allSource
13+
}
14+
target.task("javadocJar", type: Jar, dependsOn: javadoc) {
15+
classifier = 'javadoc'
16+
from javadoc.getDestinationDir()
17+
}
18+
19+
artifacts {
20+
archives sourcesJar, javadocJar
21+
}
22+
23+
publishing {
24+
publications {
25+
mavenJava(MavenPublication) {
26+
from components.java
27+
artifact sourcesJar
28+
artifact javadocJar
29+
groupId project.group
30+
artifactId project.name
31+
version project.version
32+
}
33+
}
34+
}
35+
36+
publishing.publications.all {
37+
pom.withXml {
38+
39+
def lib = project.extensions.auth0
40+
def root = asNode()
41+
42+
root.appendNode('packaging', 'jar')
43+
root.appendNode('name', lib.name)
44+
root.appendNode('description', lib.description)
45+
46+
def developersNode = root.appendNode('developers')
47+
project.extensions.auth0.developers.each {
48+
def node = developersNode.appendNode('developer')
49+
node.appendNode('id', it.id)
50+
node.appendNode('name', it.name)
51+
node.appendNode('email', it.email)
52+
}
53+
54+
def dependenciesNode = root.appendNode('dependencies')
55+
56+
configurations.compile.allDependencies.each {
57+
def dependencyNode = dependenciesNode.appendNode('dependency')
58+
dependencyNode.appendNode('groupId', it.group)
59+
dependencyNode.appendNode('artifactId', it.name)
60+
dependencyNode.appendNode('version', it.version)
61+
}
62+
63+
def licenceNode = root.appendNode('licenses').appendNode('license')
64+
licenceNode.appendNode('name', 'The MIT License (MIT)')
65+
licenceNode.appendNode('url', "https://raw.githubusercontent.com/auth0/${lib.repo}/master/LICENSE")
66+
licenceNode.appendNode('distribution', 'repo')
67+
68+
def scmNode = root.appendNode('scm')
69+
scmNode.appendNode('connection', "scm:git@github.com:auth0/${lib.repo}.git")
70+
scmNode.appendNode('developerConnection', "scm:git@github.com:auth0/${lib.repo}.git")
71+
scmNode.appendNode('url', "https://github.com/auth0/${lib.repo}")
72+
}
73+
}
74+
}
75+
}
76+
}
77+
78+
class Auth0Extension {
79+
String name
80+
String repo
81+
String description
82+
List<Developer> developers = []
83+
84+
private Project project
85+
86+
Auth0Extension(project) {
87+
this.project = project
88+
}
89+
90+
void developer(Closure<Developer> developerClosure) {
91+
def developer = project.configure(new Developer(), developerClosure)
92+
developers.add(developer)
93+
}
94+
}
95+
96+
class Developer {
97+
String id
98+
String name
99+
String email
100+
}
101+
102+
103+

0 commit comments

Comments
 (0)