org.jclouds.io.Payload.setSensitive()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中org.jclouds.io.Payload.setSensitive()方法的一些代码示例,展示了Payload.setSensitive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Payload.setSensitive()方法的具体详情如下:
包路径:org.jclouds.io.Payload
类名称:Payload
方法名:setSensitive

Payload.setSensitive介绍

[英]Sets whether the payload contains sensitive information. This is used when trying to decide whether to print out the payload information or not in logs
[中]设置有效负载是否包含敏感信息。当试图决定是否在日志中打印有效负载信息时,使用此选项

代码示例

代码示例来源:origin: com.amysta.jclouds.api/openstack-keystone

@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;
}

代码示例来源:origin: Nextdoor/bender

@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;
}

代码示例来源:origin: org.apache.jclouds.api/openstack-keystone

@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;
}

代码示例来源:origin: apache/jclouds

@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;
}

代码示例来源:origin: org.apache.jclouds.api/openstack-keystone

@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;
}

代码示例来源:origin: apache/jclouds

@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;
}

代码示例来源:origin: com.amysta.jclouds/jclouds-core

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);
}

代码示例来源:origin: Nextdoor/bender

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);
}

代码示例来源:origin: apache/jclouds

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);
}

代码示例来源:origin: Nextdoor/bender

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);
}

代码示例来源:origin: com.amysta.jclouds/jclouds-core

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);
}

代码示例来源:origin: apache/jclouds

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);
}

相关文章