JwtTokenVerifier { public String extractLogin(String token) throws JwtException { Jws<Claims> jws = parseToken(token); return jws .getBody() .getSubject(); } @Inject @VisibleForTesting  JwtTokenVerifier(PublicKeyProvider pubKeyProvider); boolean verify(String token); String extractLogin(String token); boolean hasAttribute(String attributeName, Object expectedValue, String token);  }
@Test public void shouldReturnUserLoginFromValidToken() { assertThat(sut.extractLogin(VALID_TOKEN_WITHOUT_ADMIN)).isEqualTo("1234567890"); }
@Test public void extractLoginShouldWorkWithAdminClaim() { assertThat(sut.extractLogin(VALID_TOKEN_ADMIN_TRUE)).isEqualTo("admin@open-paas.org"); }