- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.github.robozonky.api.remote.entities.ZonkyApiToken.getAccessToken()
方法的一些代码示例,展示了ZonkyApiToken.getAccessToken()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonkyApiToken.getAccessToken()
方法的具体详情如下:
包路径:com.github.robozonky.api.remote.entities.ZonkyApiToken
类名称:ZonkyApiToken
方法名:getAccessToken
暂无
代码示例来源:origin: RoboZonky/robozonky
@Override
public void filter(final ClientRequestContext clientRequestContext) {
final ZonkyApiToken supplied = token == null ? null : token.get();
logger.trace("Using token #{}.", supplied);
final char[] t = supplied == null ? AuthenticatedFilter.EMPTY_TOKEN : supplied.getAccessToken();
this.setRequestHeader("Authorization", "Bearer " + String.valueOf(t));
super.filter(clientRequestContext);
}
}
代码示例来源:origin: com.github.robozonky/robozonky-common
@Override
public void filter(final ClientRequestContext clientRequestContext) {
final ZonkyApiToken supplied = token == null ? null : token.get();
final char[] t = supplied == null ? AuthenticatedFilter.EMPTY_TOKEN : supplied.getAccessToken();
this.setRequestHeader("Authorization", "Bearer " + String.valueOf(t));
super.filter(clientRequestContext);
}
}
代码示例来源:origin: RoboZonky/robozonky
private static InputStream c(final ZonkyApiToken token) {
final String error = "{\"error\":\"invalid_token\",\"error_description\":\"Invalid access token: "
+ Arrays.toString(token.getAccessToken()) + "\"}";
return new ByteArrayInputStream(error.getBytes(Defaults.CHARSET));
}
代码示例来源:origin: RoboZonky/robozonky
private static ZonkyApiToken mockToken() {
final ZonkyApiToken t = mock(ZonkyApiToken.class);
when(t.getAccessToken()).thenReturn(UUID.randomUUID().toString().toCharArray());
return t;
}
代码示例来源:origin: RoboZonky/robozonky
@SuppressWarnings({"unchecked", "rawtypes"})
private ApiProvider mockApi(final String username, final char... password) {
final ApiProvider api = spy(new ApiProvider());
final ZonkyApiToken token = mock(ZonkyApiToken.class);
when(token.getAccessToken()).thenReturn(new char[0]);
final OAuth oauth = mock(OAuth.class);
when(oauth.login(eq(username), eq(password))).thenReturn(token);
doAnswer(i -> {
final Function f = i.getArgument(0);
return f.apply(oauth);
}).when(api).oauth(any());
final Zonky z = mock(Zonky.class);
doAnswer(i -> {
final Consumer f = i.getArgument(0);
f.accept(z);
return null;
}).when(api).run(any(Consumer.class), any());
return api;
}
代码示例来源:origin: RoboZonky/robozonky
@SuppressWarnings({"unchecked", "rawtypes"})
private ApiProvider mockFailingApi() {
final ApiProvider api = spy(new ApiProvider());
final ZonkyApiToken token = mock(ZonkyApiToken.class);
when(token.getAccessToken()).thenReturn(new char[0]);
final OAuth oauth = mock(OAuth.class);
when(oauth.login(any(), any())).thenReturn(token);
doAnswer(i -> {
final Function f = i.getArgument(0);
return f.apply(oauth);
}).when(api).oauth(any());
final Zonky z = mock(Zonky.class);
doAnswer(i -> {
final Consumer f = i.getArgument(0);
f.accept(z);
return null;
}).when(api).run(any(Consumer.class), any());
doThrow(IllegalStateException.class).when(z).logout(); // last call will fail
return api;
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void hasToken() throws URISyntaxException {
final ClientRequestContext crc = mock(ClientRequestContext.class);
when(crc.getUri()).thenReturn(new URI("http://somewhere"));
when(crc.getHeaders()).thenReturn(new MultivaluedHashMap<>());
getTestedFilter().filter(crc);
assertThat(crc.getHeaders().getFirst("Authorization"))
.isEqualTo("Bearer " + String.valueOf(AuthenticatedFilterTest.TOKEN.getAccessToken()));
}
本文整理了Java中com.github.robozonky.api.remote.entities.ZonkyApiToken.()方法的一些代码示例,展示了ZonkyApiToken.()的具体用
本文整理了Java中com.github.robozonky.api.remote.entities.ZonkyApiToken.getAccessToken()方法的一些代码示例,展示了ZonkyA
本文整理了Java中com.github.robozonky.api.remote.entities.ZonkyApiToken.getExpiresOn()方法的一些代码示例,展示了ZonkyApi
我是一名优秀的程序员,十分优秀!