/** * We do not support just supplying the projectNumber, as this causes confusion when using oauth. OAuth JWT requires * the whole email for the ISS field. This is better than confusing users with instructions like "Use the email, * except if using bearer token. Then, you don't need the entire email, just put in the numeric id part of it." */ public void justProjectIdIsInvalid() throws Exception { server.enqueue(jsonResponse("/project.json")); try { fn().apply(new Credentials(projectNumber, credential)); fail(); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), String.format("Client email %s is malformed. Should be %s", projectNumber, new GoogleComputeEngineApiMetadata().getIdentityName())); } assertEquals(server.getRequestCount(), 0); }
public void validClientEmail_extendedUid() throws Exception { server.enqueue(jsonResponse("/project.json")); URI projectSelfLink = fn().apply( new Credentials(projectNumber + "-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com", credential)); assertEquals(projectSelfLink.toString(), url("/projects/party")); assertSent(server, "GET", "/projects/" + projectNumber); }
public void validClientEmail() throws Exception { server.enqueue(jsonResponse("/project.json")); URI projectSelfLink = fn().apply(new Credentials(projectNumber + "@developer.gserviceaccount.com", credential)); assertEquals(projectSelfLink.toString(), url("/projects/party")); assertSent(server, "GET", "/projects/" + projectNumber); }