@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest, "this binder is only valid for GeneratedHttpRequests!"); GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request; Builder<String, Object> builder = ImmutableMap.builder(); addCredentialsInArgsOrNull(gRequest, builder); // TODO: is tenantName permanent? or should we switch to tenantId at some point. seems most tools // still use tenantName if (!Strings.isNullOrEmpty((String) postParams.get("tenantName"))) builder.put("tenantName", postParams.get("tenantName")); else if (!Strings.isNullOrEmpty((String) postParams.get("tenantId"))) builder.put("tenantId", postParams.get("tenantId")); R authRequest = super.bindToRequest(request, ImmutableMap.of("auth", builder.build())); authRequest.getPayload().setSensitive(true); return authRequest; }
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest, "this binder is only valid for GeneratedHttpRequests!"); GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request; Builder<String, Object> builder = ImmutableMap.builder(); addCredentialsInArgsOrNull(gRequest, builder); // TODO: is tenantName permanent? or should we switch to tenantId at some point. seems most tools // still use tenantName if (!Strings.isNullOrEmpty((String) postParams.get("tenantName"))) builder.put("tenantName", postParams.get("tenantName")); else if (!Strings.isNullOrEmpty((String) postParams.get("tenantId"))) builder.put("tenantId", postParams.get("tenantId")); R authRequest = super.bindToRequest(request, ImmutableMap.of("auth", builder.build())); authRequest.getPayload().setSensitive(true); return authRequest; }
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest, "this binder is only valid for GeneratedHttpRequests!"); GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request; Optional<Object> authentication = tryFind(gRequest.getInvocation().getArgs(), instanceOf(TenantOrDomainAndCredentials.class)); checkArgument(authentication.isPresent(), "no credentials found in the api call arguments"); @SuppressWarnings("unchecked") TenantOrDomainAndCredentials<T> credentials = (TenantOrDomainAndCredentials<T>) authentication.get(); Object scope = parseScope(credentials); Auth auth = buildAuth(credentials, scope); R authRequest = super.bindToRequest(request, ImmutableMap.of("auth", auth)); authRequest.getPayload().setSensitive(true); return authRequest; }
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest, "this binder is only valid for GeneratedHttpRequests!"); GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request; Optional<Object> authentication = tryFind(gRequest.getInvocation().getArgs(), instanceOf(TenantOrDomainAndCredentials.class)); checkArgument(authentication.isPresent(), "no credentials found in the api call arguments"); @SuppressWarnings("unchecked") TenantOrDomainAndCredentials<T> credentials = (TenantOrDomainAndCredentials<T>) authentication.get(); Object scope = parseScope(credentials); Auth auth = buildAuth(credentials, scope); R authRequest = super.bindToRequest(request, ImmutableMap.of("auth", auth)); authRequest.getPayload().setSensitive(true); return authRequest; }
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest, "this binder is only valid for GeneratedHttpRequests!"); GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request; Builder<String, Object> builder = ImmutableMap.builder(); TenantOrDomainAndCredentials<?> credentials = findCredentialsInArgs(gRequest); if (credentials != null) { CredentialType credentialType = findCredentialType(credentials.credentials().getClass()); checkArgument(credentialType != null, "the given credentials must be annotated with @CredentialType"); builder.put(credentialType.value(), credentials.credentials()); // TODO: is tenantName permanent? or should we switch to tenantId at // some point. seems most tools still use tenantName if (credentials != null) { if (!Strings.isNullOrEmpty(credentials.tenantOrDomainId())) builder.put("tenantId", credentials.tenantOrDomainId()); else if (!Strings.isNullOrEmpty(credentials.tenantOrDomainName())) builder.put("tenantName", credentials.tenantOrDomainName()); } } R authRequest = super.bindToRequest(request, ImmutableMap.of("auth", builder.build())); authRequest.getPayload().setSensitive(true); return authRequest; }
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest, "this binder is only valid for GeneratedHttpRequests!"); GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request; Builder<String, Object> builder = ImmutableMap.builder(); TenantOrDomainAndCredentials<?> credentials = findCredentialsInArgs(gRequest); if (credentials != null) { CredentialType credentialType = findCredentialType(credentials.credentials().getClass()); checkArgument(credentialType != null, "the given credentials must be annotated with @CredentialType"); builder.put(credentialType.value(), credentials.credentials()); // TODO: is tenantName permanent? or should we switch to tenantId at // some point. seems most tools still use tenantName if (credentials != null) { if (!Strings.isNullOrEmpty(credentials.tenantOrDomainId())) builder.put("tenantId", credentials.tenantOrDomainId()); else if (!Strings.isNullOrEmpty(credentials.tenantOrDomainName())) builder.put("tenantName", credentials.tenantOrDomainName()); } } R authRequest = super.bindToRequest(request, ImmutableMap.of("auth", builder.build())); authRequest.getPayload().setSensitive(true); return authRequest; }
public void input(PayloadEnclosing request) { Payload oldContent = request.getPayload(); Payload wiredPayload; if (!oldContent.isSensitive() || isLogSensitiveInformation()) { wiredPayload = newPayload(input(oldContent.getInput())); } else { wiredPayload = newPayload(oldContent.getInput()); } wiredPayload.setSensitive(oldContent.isSensitive()); copyPayloadMetadata(oldContent, wiredPayload); request.setPayload(wiredPayload); }
public void input(PayloadEnclosing request) { Payload oldContent = request.getPayload(); Payload wiredPayload; if (!oldContent.isSensitive() || isLogSensitiveInformation()) { wiredPayload = newPayload(input(oldContent.getInput())); } else { wiredPayload = newPayload(oldContent.getInput()); } wiredPayload.setSensitive(oldContent.isSensitive()); copyPayloadMetadata(oldContent, wiredPayload); request.setPayload(wiredPayload); }
public void input(PayloadEnclosing request) { Payload oldContent = request.getPayload(); Payload wiredPayload; if (!oldContent.isSensitive() || isLogSensitiveInformation()) { wiredPayload = newPayload(input(oldContent.getInput())); } else { wiredPayload = newPayload(oldContent.getInput()); } wiredPayload.setSensitive(oldContent.isSensitive()); copyPayloadMetadata(oldContent, wiredPayload); request.setPayload(wiredPayload); }
public void output(PayloadEnclosing request) { Payload oldContent = request.getPayload(); Payload wiredPayload; if (!oldContent.isSensitive() || isLogSensitiveInformation()) { try { wiredPayload = newPayload(output(oldContent.getRawContent())); } catch (UnsupportedOperationException e) { wiredPayload = newPayload(output(oldContent.getInput())); } } else { try { wiredPayload = newPayload(oldContent.getRawContent()); } catch (UnsupportedOperationException e) { wiredPayload = newPayload(oldContent.getInput()); } output("Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data."); } wiredPayload.setSensitive(oldContent.isSensitive()); copyPayloadMetadata(oldContent, wiredPayload); request.setPayload(wiredPayload); }
public void output(PayloadEnclosing request) { Payload oldContent = request.getPayload(); Payload wiredPayload; if (!oldContent.isSensitive() || isLogSensitiveInformation()) { try { wiredPayload = newPayload(output(oldContent.getRawContent())); } catch (UnsupportedOperationException e) { wiredPayload = newPayload(output(oldContent.getInput())); } } else { try { wiredPayload = newPayload(oldContent.getRawContent()); } catch (UnsupportedOperationException e) { wiredPayload = newPayload(oldContent.getInput()); } output("Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data."); } wiredPayload.setSensitive(oldContent.isSensitive()); copyPayloadMetadata(oldContent, wiredPayload); request.setPayload(wiredPayload); }
public void output(PayloadEnclosing request) { Payload oldContent = request.getPayload(); Payload wiredPayload; if (!oldContent.isSensitive() || isLogSensitiveInformation()) { try { wiredPayload = newPayload(output(oldContent.getRawContent())); } catch (UnsupportedOperationException e) { wiredPayload = newPayload(output(oldContent.getInput())); } } else { try { wiredPayload = newPayload(oldContent.getRawContent()); } catch (UnsupportedOperationException e) { wiredPayload = newPayload(oldContent.getInput()); } output("Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data."); } wiredPayload.setSensitive(oldContent.isSensitive()); copyPayloadMetadata(oldContent, wiredPayload); request.setPayload(wiredPayload); }