Skip to content

Commit 3004eac

Browse files
committed
supports now token with more than 3 parts (jwe)
1 parent ee31e17 commit 3004eac

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/main/java/org/oidc/msg/MessageUtil.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Collection of utility methods related to messages.
2323
*/
2424
public final class MessageUtil {
25-
25+
2626
private MessageUtil() {
2727
// no op
2828
}
@@ -32,7 +32,7 @@ private MessageUtil() {
3232
*
3333
* @param token
3434
* the string to split.
35-
* @return the array representing the 3 parts of the token.
35+
* @return the array representing the 3or more parts of the token.
3636
* @throws JWTDecodeException
3737
* if the Token doesn't have 3 parts.
3838
*/
@@ -42,10 +42,11 @@ public static String[] splitToken(String token) throws JWTDecodeException {
4242
// Tokens with alg='none' have empty String as Signature.
4343
parts = new String[] { parts[0], parts[1], "" };
4444
}
45-
if (parts.length != 3) {
46-
throw new JWTDecodeException(
47-
String.format("The token was expected to have 3 parts, but got %s.", parts.length));
45+
if (parts.length < 3) {
46+
throw new JWTDecodeException(String
47+
.format("The token was expected to have atleast 3 parts, but got %s.", parts.length));
4848
}
49+
4950
return parts;
5051
}
5152
}

0 commit comments

Comments
 (0)