I have two arrays containing some strings like the following:
Array #1
abcd
efgh
servicegroup_1
ijkl
Array #2
servicegroup_3
servicegroup_1
I'd like to print a string like "VERIFY: OK"
(on console) if the Array #1 contains at least one of the strings of Array #2. Otherwise, a string "VERIFY: KO"
have to be printed.
I implemented some code like the following:
for (int i = 0; i < scopeFile.length; i++) {
for (String element : scopeJWT) {
if (scopeFile[i].contains(element)) {
ctx.setSendZuulResponse(true);
System.out.println(now + " --- " + "[Check Signature: OK]" + " [Verify Scope: OK]" + " [Verify expTime: OK]");
} else {
ctx.setSendZuulResponse(false);
ctx.setResponseStatusCode(HttpStatus.UNAUTHORIZED.value());
System.err.println(now + " --- " + "[VERIFY SCOPE: KO]");
}
}
}
but, it returns both VERIFY SCOPE: OK
and VERIFY SCOPE: KO
, even if in considering the arrays I reported, I would have printed just VERIFY SCOPE: OK
(because Array #1 contains servicegroup_1
)
Any ideas to fix my code? Thank you