本文整理匯總了Java中org.springframework.vault.support.VaultResponse.setAuth方法的典型用法代碼示例。如果您正苦於以下問題:Java VaultResponse.setAuth方法的具體用法?Java VaultResponse.setAuth怎麽用?Java VaultResponse.setAuth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.vault.support.VaultResponse
的用法示例。
在下文中一共展示了VaultResponse.setAuth方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldRunTokenRenewal
import org.springframework.vault.support.VaultResponse; //導入方法依賴的package包/類
@Test
public void shouldRunTokenRenewal() {
mockToken(LoginToken.renewable("login".toCharArray(), Duration.ofSeconds(5)));
ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);
VaultResponse vaultResponse = new VaultResponse();
Map<String, Object> auth = new HashMap<>();
auth.put("client_token", "login");
auth.put("ttl", 100);
vaultResponse.setAuth(auth);
when(responseSpec.bodyToMono(VaultResponse.class)).thenReturn(
Mono.just(vaultResponse));
sessionManager.getSessionToken().as(StepVerifier::create).expectNextCount(1)
.verifyComplete();
verify(taskScheduler).schedule(runnableCaptor.capture(), any(Trigger.class));
runnableCaptor.getValue().run();
verify(webClient).post();
verify(webClient.post()).uri("auth/token/renew-self");
verify(tokenSupplier, times(1)).getVaultToken();
}
開發者ID:spring-projects,項目名稱:spring-vault,代碼行數:28,代碼來源:ReactiveLifecycleAwareSessionManagerUnitTests.java
示例2: fromToken
import org.springframework.vault.support.VaultResponse; //導入方法依賴的package包/類
private static VaultResponse fromToken(LoginToken loginToken) {
Map<String, Object> auth = new HashMap<>();
auth.put("client_token", loginToken.getToken());
auth.put("renewable", loginToken.isRenewable());
auth.put("lease_duration", loginToken.getLeaseDuration().getSeconds());
VaultResponse response = new VaultResponse();
response.setAuth(auth);
return response;
}