String securityToken = getSecurityToken(this.clientSettings.getTokenProvider(), forwardTo); additionalHeaders.put(ManagementClientConstants.ServiceBusSupplementartyAuthorizationHeaderName, securityToken); } catch (InterruptedException | ExecutionException e) { String securityToken = getSecurityToken(this.clientSettings.getTokenProvider(), fwdDeadLetterTo); additionalHeaders.put(ManagementClientConstants.ServiceBusDlqSupplementaryAuthorizationHeaderName, securityToken); } catch (InterruptedException | ExecutionException e) {
CompletableFuture<Void> sendSecurityToken(String sasTokenAudienceUri) { TRACE_LOGGER.debug("Sending token for {}", sasTokenAudienceUri); CompletableFuture<SecurityToken> tokenFuture = this.clientSettings.getTokenProvider().getSecurityTokenAsync(sasTokenAudienceUri); return tokenFuture.thenComposeAsync((t) -> { SecurityToken generatedSecurityToken = t; CompletableFuture<Void> sendTokenFuture = this.cbsLinkCreationFuture.thenComposeAsync((v) -> { return CommonRequestResponseOperations.sendCBSTokenAsync(this.cbsLink, Util.adjustServerTimeout(this.clientSettings.getOperationTimeout()), generatedSecurityToken); }, MessagingFactory.INTERNAL_THREAD_POOL); return sendTokenFuture.thenAccept((v) -> { TRACE_LOGGER.debug("Sent token for {}", sasTokenAudienceUri);}); }, MessagingFactory.INTERNAL_THREAD_POOL); }
private CompletableFuture<Instant> generateAndSendSecurityToken(String sasTokenAudienceURI) { CompletableFuture<SecurityToken> tokenFuture = this.clientSettings.getTokenProvider().getSecurityTokenAsync(sasTokenAudienceURI); return tokenFuture.thenComposeAsync((t) -> { SecurityToken generatedSecurityToken = t; return this.cbsLinkCreationFuture.thenComposeAsync((v) -> { return CommonRequestResponseOperations.sendCBSTokenAsync(this.cbsLink, ClientConstants.SAS_TOKEN_SEND_TIMEOUT, generatedSecurityToken).thenApply((u) -> generatedSecurityToken.getValidUntil()); }, MessagingFactory.INTERNAL_THREAD_POOL); }, MessagingFactory.INTERNAL_THREAD_POOL); }
private CompletableFuture<String> sendManagementHttpRequestAsync(String httpMethod, URL url, String atomEntryString, HashMap<String, String> additionalHeaders) { String securityToken = null; try { securityToken = getSecurityToken(this.clientSettings.getTokenProvider(), url.toString()); } catch (InterruptedException | ExecutionException e) { final CompletableFuture<String> exceptionFuture = new CompletableFuture<>();