@Test public void testServiceAccount() { HybridProvider provider = new HybridProvider(); AccessToken accessToken = provider.getAccessToken("alice-shadow@" + projectId + ".iam.gserviceaccount.com", SCOPES); assertTrue(accessToken.getValue().startsWith("y")); assertEquals(2, CharMatcher.is('.').countIn(accessToken.getValue())); assertTrue(accessToken.getExpiresAt() > 0); }
@Override public AccessToken getAccessToken(String googleIdentity, List<String> scopes) { if (googleIdentity.endsWith(".iam.gserviceaccount.com")) { return serviceAccountProvider.getAccessToken(googleIdentity, scopes); } else { return userProvider.getAccessToken(googleIdentity, scopes); } }
HybridProvider extends AbstractProvider { @Override public AccessToken getAccessToken(String googleIdentity, List<String> scopes) { if (googleIdentity.endsWith(".iam.gserviceaccount.com")) { return serviceAccountProvider.getAccessToken(googleIdentity, scopes); } else { return userProvider.getAccessToken(googleIdentity, scopes); } } }
HybridProvider extends AbstractProvider { @Override public AccessToken getAccessToken(String googleIdentity, List<String> scopes) { if (googleIdentity.endsWith(".iam.gserviceaccount.com")) { return serviceAccountProvider.getAccessToken(googleIdentity, scopes); } else { return userProvider.getAccessToken(googleIdentity, scopes); } } HybridProvider(); }
HybridProvider extends AbstractProvider { @Override public AccessToken getAccessToken(String googleIdentity, List<String> scopes) { if (googleIdentity.endsWith(".iam.gserviceaccount.com")) { return serviceAccountProvider.getAccessToken(googleIdentity, scopes); } else { return userProvider.getAccessToken(googleIdentity, scopes); } } HybridProvider(); @Override AccessToken getAccessToken(String googleIdentity, List<String> scopes); }
HybridProvider extends AbstractProvider { @Override public AccessToken getAccessToken(String googleIdentity, List<String> scopes) { if (googleIdentity.endsWith(".iam.gserviceaccount.com")) { return serviceAccountProvider.getAccessToken(googleIdentity, scopes); } else { return userProvider.getAccessToken(googleIdentity, scopes); } } HybridProvider(); @Override AccessToken getAccessToken(String googleIdentity, List<String> scopes);  }