Search in sources :

Example 1 with IdTokenVerifier

use of com.google.api.client.auth.openidconnect.IdTokenVerifier in project google-api-java-client by google.

the class GoogleIdTokenVerifierTest method testBuilder.

public void testBuilder() throws Exception {
    GoogleIdTokenVerifier.Builder builder = new GoogleIdTokenVerifier.Builder(new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()).setIssuer(ISSUER).setAudience(TRUSTED_CLIENT_IDS);
    assertEquals(Clock.SYSTEM, builder.getClock());
    assertEquals(ISSUER, builder.getIssuer());
    assertTrue(TRUSTED_CLIENT_IDS.equals(builder.getAudience()));
    Clock clock = new FixedClock(4);
    builder.setClock(clock);
    assertEquals(clock, builder.getClock());
    IdTokenVerifier verifier = builder.build();
    assertEquals(clock, verifier.getClock());
    assertEquals(ISSUER, verifier.getIssuer());
    assertEquals(TRUSTED_CLIENT_IDS, Lists.newArrayList(verifier.getAudience()));
}
Also used : FixedClock(com.google.api.client.testing.http.FixedClock) Clock(com.google.api.client.util.Clock) FixedClock(com.google.api.client.testing.http.FixedClock) JacksonFactory(com.google.api.client.json.jackson2.JacksonFactory) IdTokenVerifier(com.google.api.client.auth.openidconnect.IdTokenVerifier)

Aggregations

IdTokenVerifier (com.google.api.client.auth.openidconnect.IdTokenVerifier)1 JacksonFactory (com.google.api.client.json.jackson2.JacksonFactory)1 FixedClock (com.google.api.client.testing.http.FixedClock)1 Clock (com.google.api.client.util.Clock)1