Skip to content

Commit a6c8957

Browse files
committed
Deprecate the X5T JOSE Header name
Closes spring-projectsgh-16979 Signed-off-by: Pat McCusker <[email protected]>
1 parent 665a34d commit a6c8957

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JoseHeader.java

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -119,7 +119,15 @@ public List<String> getX509CertificateChain() {
119119
* thumbprint (a.k.a. digest) of the DER encoding of the X.509 certificate
120120
* corresponding to the key used to digitally sign the JWS or encrypt the JWE.
121121
* @return the X.509 certificate SHA-1 thumbprint
122+
* @deprecated The SHA-1 algorithm has been proven to be vulnerable to collision
123+
* attacks and should not be used. See the <a target="_blank" href=
124+
* "https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html">Google
125+
* Security Blog</a> for more info.
126+
* @see <a target="_blank" href=
127+
* "https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html">Announcing
128+
* the first SHA1 collision</a>
122129
*/
130+
@Deprecated
123131
public String getX509SHA1Thumbprint() {
124132
return getHeader(JoseHeaderNames.X5T);
125133
}
@@ -271,7 +279,15 @@ public B x509CertificateChain(List<String> x509CertificateChain) {
271279
* corresponding to the key used to digitally sign the JWS or encrypt the JWE.
272280
* @param x509SHA1Thumbprint the X.509 certificate SHA-1 thumbprint
273281
* @return the {@link AbstractBuilder}
282+
* @deprecated The SHA-1 algorithm has been proven to be vulnerable to collision
283+
* attacks and should not be used. See the <a target="_blank" href=
284+
* "https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html">Google
285+
* Security Blog</a> for more info.
286+
* @see <a target="_blank" href=
287+
* "https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html">Announcing
288+
* the first SHA1 collision</a>
274289
*/
290+
@Deprecated
275291
public B x509SHA1Thumbprint(String x509SHA1Thumbprint) {
276292
return header(JoseHeaderNames.X5T, x509SHA1Thumbprint);
277293
}

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JoseHeaderNames.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -76,7 +76,15 @@ public final class JoseHeaderNames {
7676
* {@code x5t} - the X.509 certificate SHA-1 thumbprint header is a base64url-encoded
7777
* SHA-1 thumbprint (a.k.a. digest) of the DER encoding of the X.509 certificate
7878
* corresponding to the key used to digitally sign a JWS or encrypt a JWE
79+
* @deprecated The SHA-1 algorithm has been proven to be vulnerable to collision
80+
* attacks and should not be used. See the <a target="_blank" href=
81+
* "https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html">Google
82+
* Security Blog</a> for more info.
83+
* @see <a target="_blank" href=
84+
* "https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html">Announcing
85+
* the first SHA1 collision</a>
7986
*/
87+
@Deprecated
8088
public static final String X5T = "x5t";
8189

8290
/**

0 commit comments

Comments
 (0)