Skip to content

Commit

Permalink
Switch to smallrye-parent 39 (#683)
Browse files Browse the repository at this point in the history
* Switch to smallrye-parent 39

* SR Parent 39
- Move to Jakarta 10
- Use SmallRye Testing BOM and Jetty
- Move to JUnit 5

---------

Co-authored-by: Roberto Cortez <radcortez@yahoo.com>
  • Loading branch information
sberyozkin and radcortez authored Feb 24, 2023
1 parent d090ee4 commit 0065c15
Show file tree
Hide file tree
Showing 56 changed files with 1,242 additions and 1,315 deletions.
3 changes: 2 additions & 1 deletion implementation/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
</dependency>

<!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* * JWT JSON Web Content Encryption Algorithms.
*
*
* @see <a href="https://tools.ietf.org/html/rfc7518#section-5">https://tools.ietf.org/html/rfc7518#section-5</a>
*/
public enum ContentEncryptionAlgorithm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* JWT JSON Web Key Encryption (Management) Algorithms.
*
*
* @see <a href="https://tools.ietf.org/html/rfc7518#section-4">https://tools.ietf.org/html/rfc7518#section-4</a>
*/
public enum KeyEncryptionAlgorithm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* JWT JSON Web Signature Algorithms.
*
*
* @see <a href="https://tools.ietf.org/html/rfc7518#section-3">https://tools.ietf.org/html/rfc7518#section-3</a>
*/
public enum SignatureAlgorithm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static KeyPair generateKeyPair(int keySize, SignatureAlgorithm algo) thro

/**
* Decode a PEM RSA private key
*
*
* @param pemEncoded - pem string for key
* @return RSA private key instance
* @throws GeneralSecurityException - on failure to decode and create key
Expand All @@ -160,7 +160,7 @@ public static PrivateKey decodePrivateKey(String pemEncoded) throws GeneralSecur

/**
* Decode a PEM private key
*
*
* @param pemEncoded - pem string for key
* @param algo - signature algorithm
* @return Private key instance
Expand Down Expand Up @@ -207,7 +207,7 @@ static PrivateKey decodePrivateKeyInternal(String pemEncoded, String algo) throw

/**
* Decode a PEM encoded public key string to an RSA PublicKey
*
*
* @param pemEncoded - PEM string for public key
* @return PublicKey
* @throws GeneralSecurityException on decode failure
Expand Down Expand Up @@ -266,7 +266,7 @@ public static SecretKey generateSecretKey(SignatureAlgorithm algo) throws Invali

/**
* Decode a PEM encoded public key string to an RSA or EllipticCurve PublicKey
*
*
* @param pemEncoded - PEM string for public key
* @param algo signature algorithm
* @return PublicKey
Expand Down Expand Up @@ -350,7 +350,7 @@ static String encryptionKeyFactoryAlgorithm(KeyEncryptionAlgorithm algo) throws

/**
* Decode a PEM encoded certificate string to an RSA PublicKey
*
*
* @param pemEncoded - PEM string for certificate
* @return PublicKey
* @throws GeneralSecurityException on decode failure
Expand All @@ -375,7 +375,7 @@ public static X509Certificate getCertificate(String pemEncoded) throws GeneralSe

/**
* Strip any -----BEGIN*KEY... header and -----END*KEY... footer and newlines
*
*
* @param pem encoded string with option header/footer
* @return a single base64 encoded pem string
*/
Expand All @@ -390,7 +390,7 @@ public static String removePemKeyBeginEnd(String pem) {

/**
* Strip any -----BEGIN*CERTIFICATE... header and -----END*CERTIFICATE... footer and newlines
*
*
* @param pem encoded string with option header/footer
* @return a single base64 encoded pem string
*/
Expand Down
21 changes: 12 additions & 9 deletions implementation/jwt-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,26 @@
<artifactId>jboss-logging-processor</artifactId>
</dependency>

<!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${version.mokito}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-junit4</artifactId>
<scope>test</scope>
<artifactId>weld-junit5</artifactId>
<exclusions>
<exclusion>
<groupId>javax.enterprise</groupId>
Expand All @@ -107,14 +113,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<scope>test</scope>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
Expand All @@ -135,7 +139,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<executions>
<execution>
<id>default-integration-test</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package io.smallrye.jwt;

import static jakarta.json.JsonValue.NULL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Arrays;
import java.util.HashMap;
Expand All @@ -29,52 +29,51 @@
import jakarta.json.JsonObject;
import jakarta.json.JsonValue;

import org.junit.Test;

public class JsonUtilsTests {
import org.junit.jupiter.api.Test;

class JsonUtilsTests {
@Test
public void testWrapClaimValueJsonValue() {
void wrapClaimValueJsonValue() {
JsonValue expResult = JsonValue.TRUE;
JsonValue result = JsonUtils.wrapValue(expResult);

assertEquals(expResult, result);
}

@Test
public void testWrapClaimValueString() {
void wrapClaimValueString() {
JsonValue expResult = Json.createValue("string");
JsonValue result = JsonUtils.wrapValue("string");

assertEquals(expResult, result);
}

@Test
public void testWrapClaimValueNumber() {
void wrapClaimValueNumber() {
JsonValue expResult = Json.createValue(1);
JsonValue result = JsonUtils.wrapValue(1);

assertEquals(expResult, result);
}

@Test
public void testWrapClaimValueNumberDecimal() {
void wrapClaimValueNumberDecimal() {
JsonValue expResult = Json.createValue(1.1d);
JsonValue result = JsonUtils.wrapValue(1.1d);

assertEquals(expResult, result);
}

@Test
public void testWrapClaimValueBoolean() {
void wrapClaimValueBoolean() {
JsonValue expResult = JsonValue.FALSE;
JsonValue result = JsonUtils.wrapValue(false);

assertEquals(expResult, result);
}

@Test
public void testWrapClaimValueCollection() {
void wrapClaimValueCollection() {
JsonArray expResult = Json.createArrayBuilder()
.add("a")
.add("b")
Expand All @@ -91,7 +90,7 @@ public void testWrapClaimValueCollection() {
}

@Test
public void testWrapClaimValueMap() {
void wrapClaimValueMap() {
JsonObject expResult = Json.createObjectBuilder()
.add("a", "a")
.add("b", "b")
Expand All @@ -110,15 +109,15 @@ public void testWrapClaimValueMap() {
}

@Test
public void testWrapClaimValueNull() {
void wrapClaimValueNull() {
JsonValue expResult = null;
JsonValue result = JsonUtils.wrapValue(null);

assertEquals(expResult, result);
}

@Test
public void testWrapClaimValueCollectionWithNull() {
void wrapClaimValueCollectionWithNull() {
JsonArray expResult = Json.createArrayBuilder()
.add(NULL)
.build();
Expand All @@ -131,7 +130,7 @@ public void testWrapClaimValueCollectionWithNull() {
}

@Test
public void testWrapClaimValueMapWithNull() {
void wrapClaimValueMapWithNull() {
JsonObject expResult = Json.createObjectBuilder()
.build();

Expand All @@ -143,5 +142,4 @@ public void testWrapClaimValueMapWithNull() {
JsonObject resultObject = result.asJsonObject();
assertEquals(expResult, resultObject);
}

}
Loading

0 comments on commit 0065c15

Please sign in to comment.