    @Test(expected = BadCredentialsException.class)
    public void shouldFailOnBadSignature() {

        final JwtAuthenticationProvider jwtAuthenticationProvider = new JwtAuthenticationProvider();

        String jwt = getJWT(120);
        int signIndex = jwt.lastIndexOf('.');
        jwt = jwt.substring(0, signIndex) + ".123456";

        final JwtAuthenticationToken jwtAuthenticationToken = new JwtAuthenticationToken(jwt);
        jwtAuthenticationProvider.authenticate(new JwtAuthenticationToken(jwtAuthenticationToken));
    }