本文整理匯總了Java中org.springframework.security.oauth2.client.OAuth2RestTemplate.getForObject方法的典型用法代碼示例。如果您正苦於以下問題:Java OAuth2RestTemplate.getForObject方法的具體用法?Java OAuth2RestTemplate.getForObject怎麽用?Java OAuth2RestTemplate.getForObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.security.oauth2.client.OAuth2RestTemplate
的用法示例。
在下文中一共展示了OAuth2RestTemplate.getForObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testConnectDirectlyToResourceServer
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void testConnectDirectlyToResourceServer() throws Exception {
ResourceOwnerPasswordResourceDetails resource = new ResourceOwnerPasswordResourceDetails();
resource.setAccessTokenUri(tokenUrl);
resource.setId("microservice-test");
resource.setClientId("oauthClient1");
resource.setClientSecret("oauthClient1Password");
resource.setGrantType("password");
resource.setScope(Arrays.asList("openid"));
resource.setUsername("[email protected]");
resource.setPassword("user1");
OAuth2RestTemplate template = new OAuth2RestTemplate(resource);
logger.info(" CALLING: " + baseUrl+"/api");
String result = template.getForObject(baseUrl+"/api", String.class);
System.err.println(result);
assertEquals("Hello, Trusted User marissa", result);
}
示例2: testConnectDirectlyToResourceServer
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void testConnectDirectlyToResourceServer() throws Exception {
OAuth2RestTemplate template = template();
logger.info(" CALLING: " + baseUrl+"/api");
String result = template.getForObject(baseUrl+"/api", String.class);
logger.info(" RESULT: " + result);
assertEquals("{Hello API}", result);
logger.info(" CALLING: " + baseUrl+"/events/101/");
result = template.getForObject(baseUrl+"/events/101/", String.class);
logger.info(" RESULT: " + result);
// assertEquals("{[\"id\":101,\"summary\":\"Conference Call\",\"description\":\"Call with the client\",\"when\":1514059200000]}", result);
//
logger.info(" CALLING: " + baseUrl+"/events/my/");
result = template.getForObject(baseUrl+"/events/my/", String.class);
logger.info(" RESULT: " + result);
assertEquals("{Hello API}", result);
}
示例3: test_post_signup_user1
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_post_signup_user1() throws Exception {
OAuth2RestTemplate template = template("user1");
String url = baseUrl+"/signup/new";
String expected = "foobar";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
// String result = template.postForObject(url, Object request, String.class, Object... uriVariables)
// String result = template.postForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, is(expected));
}
示例4: test_myEvents_admin1
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
@Test
public void test_myEvents_admin1() throws Exception {
OAuth2RestTemplate template = template("admin1");
String url = baseUrl+"/events/my";
String expected = "{\"currentUser\":[{\"id\":102,\"summary\":\"Vacation\",\"description\":\"Paragliding in Greece\",\"when\":";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, startsWith(expected));
}
示例5: test_post_signup
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_post_signup() throws Exception {
OAuth2RestTemplate template = template();
String url = baseUrl+"/signup/new";
String expected = "foobar";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
// String result = template.postForObject(url, Object request, String.class, Object... uriVariables)
// String result = template.postForObject(url, String.class);
logger.info(" RESULT: {}", result);
Assert.assertThat(result, is(expected));
}
示例6: test_show
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_show() throws Exception {
OAuth2RestTemplate template = template();
String url = baseUrl+"/events/101";
String expected = "{\"id\":101,\"summary\":\"Conference Call\",\"description\":\"Call with the client\",\"when\":1514059200000}";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
Assert.assertThat(result, is(expected));
}
示例7: test_rootContext
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
@Test
public void test_rootContext() throws Exception {
OAuth2RestTemplate template = template("user1");
String url = baseUrl+"/";
String expected = "{'message': 'welcome to the JBCP Calendar Application'}";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, is(expected));
}
示例8: test_api
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
@Test
public void test_api() throws Exception {
OAuth2RestTemplate template = template("user1");
String url = baseUrl+"/api";
String expected = "{'message': 'welcome to the JBCP Calendar Application API'}";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, is(expected));
}
示例9: test_signup_user1
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_signup_user1() throws Exception {
OAuth2RestTemplate template = template("user1");
String url = baseUrl+"/signup/new";
String expected = "foobar";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, is(expected));
}
示例10: test_createEvent
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_createEvent() throws Exception {
OAuth2RestTemplate template = template();
String url = baseUrl+"/events/new";
String expected = "foobar";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
Assert.assertThat(result, is(expected));
}
示例11: test_new_create_new_EventFormAutoPopulate
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_new_create_new_EventFormAutoPopulate() throws Exception {
OAuth2RestTemplate template = template();
String url = baseUrl+"/events/new?auto";
String expected = "foobar";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
// String result = template.postForObject(url, String.class);
logger.info(" RESULT: {}", result);
Assert.assertThat(result, is(expected));
}
示例12: test_show_user1
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
@Test
public void test_show_user1() throws Exception {
OAuth2RestTemplate template = template("user1");
String url = baseUrl+"/events/101";
String expected = "{\"id\":101,\"summary\":\"Conference Call\",\"description\":\"Call with the client\",\"when\":";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, startsWith(expected));
}
示例13: test_new_create_new_EventFormAutoPopulate
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_new_create_new_EventFormAutoPopulate() throws Exception {
OAuth2RestTemplate template = template("user1");
String url = baseUrl+"/events/new?auto";
String expected = "foobar";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
// String result = template.postForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, is(expected));
}
示例14: test_myEvents
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
public void test_myEvents() throws Exception {
OAuth2RestTemplate template = template();
String url = baseUrl+"/events/my";
String expected = "{\"currentUser\":[{\"id\":100,\"summary\":\"Birthday Party\",\"description\":\"This is going to be a great birthday\",\"when\":1499135400000}]}";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
Assert.assertThat(result, is(expected));
}
示例15: test_default_user1
import org.springframework.security.oauth2.client.OAuth2RestTemplate; //導入方法依賴的package包/類
@Test
public void test_default_user1() throws Exception {
OAuth2RestTemplate template = template("user1");
String url = baseUrl+"/default";
String expected = "{'message': 'welcome to the JBCP Calendar Application'}";
logger.info(" CALLING: {}", url);
String result = template.getForObject(url, String.class);
logger.info(" RESULT: {}", result);
assertThat(result, is(expected));
}