@Test public void verifyShouldNotAcceptNoneAlgorithmWithoutSignature() { assertThat(sut.verify(TOKEN_NONE_ALGORITHM_NO_SIGNATURE)).isFalse(); }
public boolean verify(String token) { try { String subject = extractLogin(token); if (Strings.isNullOrEmpty(subject)) { throw new MalformedJwtException("'subject' field in token is mandatory"); } return true; } catch (JwtException e) { LOGGER.info("Failed Jwt verification", e); return false; } }
JwtTokenVerifier { public boolean verify(String token) { try { String subject = extractLogin(token); if (Strings.isNullOrEmpty(subject)) { throw new MalformedJwtException("'subject' field in token is mandatory"); } return true; } catch (JwtException e) { LOGGER.info("Failed Jwt verification", e); return false; } } }
JwtTokenVerifier { public boolean verify(String token) { try { String subject = extractLogin(token); if (Strings.isNullOrEmpty(subject)) { throw new MalformedJwtException("'subject' field in token is mandatory"); } return true; } catch (JwtException e) { LOGGER.info("Failed Jwt verification", e); return false; } } @Inject @VisibleForTesting  JwtTokenVerifier(PublicKeyProvider pubKeyProvider); }
JwtTokenVerifier { public boolean verify(String token) { try { String subject = extractLogin(token); if (Strings.isNullOrEmpty(subject)) { throw new MalformedJwtException("'subject' field in token is mandatory"); } return true; } catch (JwtException e) { LOGGER.info("Failed Jwt verification", e); return false; } } @Inject @VisibleForTesting  JwtTokenVerifier(PublicKeyProvider pubKeyProvider); boolean verify(String token); String extractLogin(String token); boolean hasAttribute(String attributeName, Object expectedValue, String token); }
JwtTokenVerifier { public boolean verify(String token) { try { String subject = extractLogin(token); if (Strings.isNullOrEmpty(subject)) { throw new MalformedJwtException("'subject' field in token is mandatory"); } return true; } catch (JwtException e) { LOGGER.info("Failed Jwt verification", e); return false; } } @Inject @VisibleForTesting  JwtTokenVerifier(PublicKeyProvider pubKeyProvider); boolean verify(String token); String extractLogin(String token); boolean hasAttribute(String attributeName, Object expectedValue, String token);  }