Prevent ArrayIndexOutOfBoundsException in JwtTokenFilter.getTokenString
This commit is contained in:
parent
1635c21da1
commit
290c4bf4b3
@ -48,10 +48,15 @@ public class JwtTokenFilter extends OncePerRequestFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Optional<String> getTokenString(String header) {
|
private Optional<String> getTokenString(String header) {
|
||||||
if (header == null || header.split("").length < 2) {
|
if (header == null)
|
||||||
|
return Optional.empty();
|
||||||
|
else {
|
||||||
|
String[] split = header.split(" ");
|
||||||
|
if (split.length < 2) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
} else {
|
} else {
|
||||||
return Optional.ofNullable(header.split(" ")[1]);
|
return Optional.ofNullable(split[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user