DomainWideDelegationAuthorityProvider extends AbstractUserProvider { @Override public AccessToken getAccessToken(String googleIdentity, List<String> scopes) { String signedJWT = getSignedJWT(googleIdentity, scopes); return tradeSignedJWTForAccessToken(signedJWT); }  @Override AccessToken getAccessToken(String googleIdentity, List<String> scopes);  }
@Test public void testUnauthorized() { DomainWideDelegationAuthorityProvider provider = new DomainWideDelegationAuthorityProvider(); try { provider.getAccessToken("bob@example.com", SCOPES); fail(); } catch (StatusRuntimeException e) { assertEquals(Status.PERMISSION_DENIED.getCode(), e.getStatus().getCode()); } }