Skip to content

Commit 1fe30f5

Browse files
[7.17] Update OIDC and JWT dependencies (#96862) (#96917)
* Update OIDC and JWT dependencies (#96862) Updates internal dependencies for OIDC and JWT realms. * Order --------- Co-authored-by: Elastic Machine <[email protected]>
1 parent edb34ad commit 1fe30f5

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

gradle/verification-metadata.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -974,9 +974,14 @@
974974
<sha256 value="7664cf8c6f2adadf600287812b32878277beda54912eab9d4c2932cd50cb704a" origin="Generated by Gradle"/>
975975
</artifact>
976976
</component>
977-
<component group="com.nimbusds" name="oauth2-oidc-sdk" version="9.3.1">
978-
<artifact name="oauth2-oidc-sdk-9.3.1.jar">
979-
<sha256 value="6ebf20268af33b31fc21486a59571b03013940a5e051cb4925d08c2c1e6e017c" origin="Generated by Gradle"/>
977+
<component group="com.nimbusds" name="nimbus-jose-jwt" version="9.23">
978+
<artifact name="nimbus-jose-jwt-9.23.jar">
979+
<sha256 value="33ab8084fdae1d75be1b061b1489d4a12045bd7b50c2e24ff152911e4551ec07" origin="Generated by Gradle"/>
980+
</artifact>
981+
</component>
982+
<component group="com.nimbusds" name="oauth2-oidc-sdk" version="9.37">
983+
<artifact name="oauth2-oidc-sdk-9.37.jar">
984+
<sha256 value="44a04bbed5ae3f6d198aa73ee6b545c476e528ec1a267ef3e9f7033f886dd6fe" origin="Generated by Gradle"/>
980985
</artifact>
981986
</component>
982987
<component group="com.perforce" name="p4java" version="2015.2.1365273">

x-pack/plugin/security/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ dependencies {
6666
runtimeOnly 'com.google.guava:guava:19.0'
6767

6868
// Dependencies for oidc
69-
api "com.nimbusds:oauth2-oidc-sdk:9.3.1"
70-
api "com.nimbusds:nimbus-jose-jwt:9.8.1"
69+
api "com.nimbusds:oauth2-oidc-sdk:9.37"
70+
api "com.nimbusds:nimbus-jose-jwt:9.23"
7171
api "com.nimbusds:lang-tag:1.4.4"
7272
api "com.sun.mail:jakarta.mail:1.6.3"
7373
api "net.jcip:jcip-annotations:1.0"
@@ -90,7 +90,7 @@ dependencies {
9090
testImplementation('org.apache.kerby:kerb-crypto:1.1.1')
9191
testImplementation('org.apache.kerby:kerb-util:1.1.1')
9292
testImplementation('org.apache.kerby:token-provider:1.1.1')
93-
testImplementation('com.nimbusds:nimbus-jose-jwt:9.8.1')
93+
testImplementation('com.nimbusds:nimbus-jose-jwt:9.23')
9494
testImplementation('net.jcip:jcip-annotations:1.0')
9595
testImplementation('org.apache.kerby:kerb-admin:1.1.1')
9696
testImplementation('org.apache.kerby:kerb-server:1.1.1')
@@ -384,6 +384,7 @@ tasks.named("thirdPartyAudit").configure {
384384
'com.google.crypto.tink.subtle.Ed25519Sign$KeyPair',
385385
'com.google.crypto.tink.subtle.Ed25519Verify',
386386
'com.google.crypto.tink.subtle.X25519',
387+
'com.google.crypto.tink.subtle.XChaCha20Poly1305',
387388
'com.nimbusds.common.contenttype.ContentType'
388389
)
389390

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectTestCase.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import com.nimbusds.jose.JWSAlgorithm;
1010
import com.nimbusds.jose.JWSHeader;
1111
import com.nimbusds.jose.crypto.RSASSASigner;
12+
import com.nimbusds.jose.shaded.json.JSONStyle;
13+
import com.nimbusds.jose.shaded.json.JSONValue;
14+
import com.nimbusds.jose.shaded.json.reader.JsonWriterI;
1215
import com.nimbusds.jwt.JWT;
1316
import com.nimbusds.jwt.JWTClaimsSet;
1417
import com.nimbusds.jwt.SignedJWT;
@@ -22,6 +25,7 @@
2225
import org.elasticsearch.test.ESTestCase;
2326
import org.elasticsearch.xpack.core.security.authc.RealmConfig;
2427
import org.elasticsearch.xpack.core.security.authc.oidc.OpenIdConnectRealmSettings;
28+
import org.junit.BeforeClass;
2529

2630
import java.io.IOException;
2731
import java.nio.file.Files;
@@ -36,6 +40,19 @@
3640

3741
public abstract class OpenIdConnectTestCase extends ESTestCase {
3842

43+
@BeforeClass
44+
public static void setupWriters() {
45+
// In test code, we sometimes create claims sets with claims that use the `Nonce` class; therefore, we register a writer
46+
// for them here; otherwise json-smart tries to use reflection which our security manage prohibits
47+
// This only applies to test, not prod code, since we don't create claim sets with "non-default" classes
48+
JSONValue.registerWriter(Nonce.class, new JsonWriterI<Nonce>() {
49+
@Override
50+
public <E extends Nonce> void writeJSONString(E e, Appendable appendable, JSONStyle jsonStyle) throws IOException {
51+
appendable.append(e.toJSONString());
52+
}
53+
});
54+
}
55+
3956
protected static final String REALM_NAME = "oidc-realm";
4057

4158
protected static Settings.Builder getBasicRealmSettings() {

0 commit comments

Comments
 (0)