-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ANCHOR-687] Upgrade to JDK-17 (#1367)
### Description - Upgrade JDK from 11 to 17. - Fix Jwt Json serialization ### Context - JDK 11 is expected to sunset in 10/2024. ### Testing - `./gradlew test` ### Documentation Update `How to Contribute` doc. ### Known limitations N/A
- Loading branch information
Showing
20 changed files
with
129 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
core/src/main/java/org/stellar/anchor/auth/JwtsGsonDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.stellar.anchor.auth; | ||
|
||
import com.google.gson.Gson; | ||
import io.jsonwebtoken.io.DeserializationException; | ||
import io.jsonwebtoken.io.Deserializer; | ||
import java.io.Reader; | ||
import java.util.Map; | ||
import org.stellar.anchor.util.GsonUtils; | ||
|
||
public class JwtsGsonDeserializer implements Deserializer<Map<String, ?>> { | ||
private static final Gson gson = GsonUtils.getInstance(); | ||
|
||
public static JwtsGsonDeserializer newInstance() { | ||
return new JwtsGsonDeserializer(); | ||
} | ||
|
||
@Override | ||
public Map<String, ?> deserialize(byte[] bytes) throws DeserializationException { | ||
return gson.fromJson(new String(bytes), Map.class); | ||
} | ||
|
||
@Override | ||
public Map<String, ?> deserialize(Reader reader) throws DeserializationException { | ||
return gson.fromJson(reader, Map.class); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
core/src/main/java/org/stellar/anchor/auth/JwtsGsonSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.stellar.anchor.auth; | ||
|
||
import com.google.gson.Gson; | ||
import io.jsonwebtoken.io.SerializationException; | ||
import io.jsonwebtoken.io.Serializer; | ||
import java.io.OutputStream; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.Map; | ||
import lombok.SneakyThrows; | ||
import org.stellar.anchor.util.GsonUtils; | ||
|
||
public class JwtsGsonSerializer implements Serializer<Map<String, ?>> { | ||
private static final Gson gson = GsonUtils.getInstance(); | ||
|
||
public static JwtsGsonSerializer newInstance() { | ||
return new JwtsGsonSerializer(); | ||
} | ||
|
||
@Override | ||
public byte[] serialize(Map<String, ?> stringMap) throws SerializationException { | ||
return gson.toJson(stringMap).getBytes(StandardCharsets.UTF_8); | ||
} | ||
|
||
@SneakyThrows | ||
@Override | ||
public void serialize(Map<String, ?> stringMap, OutputStream outputStream) | ||
throws SerializationException { | ||
outputStream.write(serialize(stringMap)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.