use of com.google.api.client.json.webtoken.JsonWebSignature.Header in project google-api-java-client by google.
the class GoogleIdTokenVerifierTest method testVerify.
public void testVerify() throws Exception {
GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()).build();
Header header = new Header();
header.setAlgorithm("RS25");
Payload payload = newPayload(CLIENT_ID);
Payload payload2 = newPayload(CLIENT_ID + "2");
GoogleIdToken idToken = new GoogleIdToken(header, payload, new byte[0], new byte[0]);
GoogleIdToken idToken2 = new GoogleIdToken(header, payload2, new byte[0], new byte[0]);
assertFalse(verifier.verify(idToken));
assertFalse(verifier.verify(idToken2));
verifier = new GoogleIdTokenVerifier(new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory());
assertFalse(verifier.verify(idToken));
assertFalse(verifier.verify(idToken2));
// TODO(yanivi): add a unit test that returns true
}
Aggregations