Skip to content

Commit de98473

Browse files
author
Zihlu Wang
committed
fix(simple-jwt-jjwt): Fixed the issue that cannot create the bean of JjwtTokenResolver with a 32-character secret.
1 parent 5350b5d commit de98473

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

simple-jwt-jjwt/src/main/java/cn/org/codecrafters/simplejwt/jjwt/JjwtTokenResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public JjwtTokenResolver(GuidCreator<?> jtiCreator, TokenAlgorithm algorithm, St
113113
throw new IllegalArgumentException("A secret is required to build a JSON Web Token.");
114114
}
115115

116-
if (secret.length() <= 32) {
116+
if (secret.length() < 32) {
117117
log.error("""
118-
The provided secret which owns {} characters is too weak. Please replace it with a stronger one.""",
118+
The provided secret which owns {} characters is too weak. Please replace it with a stronger one.""",
119119
secret.length());
120120
throw new WeakSecretException("""
121121
The provided secret which owns %s characters is too weak. Please replace it with a stronger one."""
@@ -133,7 +133,7 @@ public JjwtTokenResolver(TokenAlgorithm algorithm, String issuer, String secret)
133133
throw new IllegalArgumentException("A secret is required to build a JSON Web Token.");
134134
}
135135

136-
if (secret.length() <= 32) {
136+
if (secret.length() < 32) {
137137
log.error(
138138
"The provided secret which owns {} characters is too weak. Please replace it with a stronger one.",
139139
secret.length());
@@ -153,7 +153,7 @@ public JjwtTokenResolver(String issuer, String secret) {
153153
throw new IllegalArgumentException("A secret is required to build a JSON Web Token.");
154154
}
155155

156-
if (secret.length() <= 32) {
156+
if (secret.length() < 32) {
157157
log.error(
158158
"The provided secret which owns {} characters is too weak. Please replace it with a stronger one.",
159159
secret.length());

0 commit comments

Comments
 (0)