本文整理汇总了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));
}