當前位置: 首頁>>代碼示例>>Java>>正文


Java VaultResponse.setAuth方法代碼示例

本文整理匯總了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;
	}
 
開發者ID:spring-projects,項目名稱:spring-vault,代碼行數:14,代碼來源:LifecycleAwareSessionManagerUnitTests.java


注:本文中的org.springframework.vault.support.VaultResponse.setAuth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。