@Test public void testExtraParamsSuppressed() throws Exception { serviceProvider.setRejectExtraParams(true); MakeRequestClient client = makeStrictNonSocialClient("owner", "owner", GADGET_URL); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("", response.getResponseAsString()); client.approveToken("user_data=hello-oauth"); response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("User data is hello-oauth", response.getResponseAsString()); }
@Test public void testExtraParamsSuppressed() throws Exception { serviceProvider.setRejectExtraParams(true); MakeRequestClient client = makeStrictNonSocialClient("owner", "owner", GADGET_URL); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("", response.getResponseAsString()); client.approveToken("user_data=hello-oauth"); response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("User data is hello-oauth", response.getResponseAsString()); }
@Test public void testExtraParamsSuppressed() throws Exception { serviceProvider.setRejectExtraParams(true); MakeRequestClient client = makeStrictNonSocialClient("owner", "owner", GADGET_URL); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("", response.getResponseAsString()); client.approveToken("user_data=hello-oauth"); response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("User data is hello-oauth", response.getResponseAsString()); }
/** * Test trusted parameters will always be sent when signOwner and signViewer * are false. */ @Test public void testAlwaysAppendTrustedParams() throws Exception { serviceProvider.setCheckTrustedParams(true); MakeRequestClient client = makeStrictNonSocialClient("owner", "owner", GADGET_URL); client.setTrustedParam("oauth_magic", "foo"); client.setTrustedParam("opensocial_magic", "bar"); client.setTrustedParam("xoauth_magic", "quux"); client.setTrustedParam("opensocial_owner_id", "overridden_opensocial_owner_id"); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("", response.getResponseAsString()); client.approveToken("user_data=hello-oauth"); response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("User data is hello-oauth", response.getResponseAsString()); assertEquals(12, serviceProvider.getTrustedParamCount()); }
/** * Test trusted parameters will always be sent when signOwner and signViewer * are false. */ @Test public void testAlwaysAppendTrustedParams() throws Exception { serviceProvider.setCheckTrustedParams(true); MakeRequestClient client = makeStrictNonSocialClient("owner", "owner", GADGET_URL); client.setTrustedParam("oauth_magic", "foo"); client.setTrustedParam("opensocial_magic", "bar"); client.setTrustedParam("xoauth_magic", "quux"); client.setTrustedParam("opensocial_owner_id", "overridden_opensocial_owner_id"); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("", response.getResponseAsString()); client.approveToken("user_data=hello-oauth"); response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("User data is hello-oauth", response.getResponseAsString()); assertEquals(12, serviceProvider.getTrustedParamCount()); }
/** * Test trusted parameters will always be sent when signOwner and signViewer * are false. */ @Test public void testAlwaysAppendTrustedParams() throws Exception { serviceProvider.setCheckTrustedParams(true); MakeRequestClient client = makeStrictNonSocialClient("owner", "owner", GADGET_URL); client.setTrustedParam("oauth_magic", "foo"); client.setTrustedParam("opensocial_magic", "bar"); client.setTrustedParam("xoauth_magic", "quux"); client.setTrustedParam("opensocial_owner_id", "overridden_opensocial_owner_id"); HttpResponse response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("", response.getResponseAsString()); client.approveToken("user_data=hello-oauth"); response = client.sendGet(FakeOAuthServiceProvider.RESOURCE_URL); assertEquals("User data is hello-oauth", response.getResponseAsString()); assertEquals(12, serviceProvider.getTrustedParamCount()); }