Skip to content

Commit 283cb6d

Browse files
committed
Log that the CallCredentials will be applied to all stubs automatically
Also hide the extraHeaders.values from StaticSecurityHeaderCallCredentials.toString() to avoid writing credentials to the log.
1 parent 283c7ab commit 283cb6d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/autoconfigure/GrpcClientSecurityAutoConfiguration.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import io.grpc.CallCredentials;
2626
import io.grpc.stub.AbstractStub;
27+
import lombok.extern.slf4j.Slf4j;
2728
import net.devh.boot.grpc.client.inject.StubTransformer;
2829
import net.devh.boot.grpc.client.security.CallCredentialsHelper;
2930

@@ -40,6 +41,7 @@
4041
*
4142
* @author Daniel Theuke ([email protected])
4243
*/
44+
@Slf4j
4345
@Configuration(proxyBeanMethods = false)
4446
@AutoConfigureBefore(GrpcClientAutoConfiguration.class)
4547
public class GrpcClientSecurityAutoConfiguration {
@@ -60,6 +62,7 @@ public class GrpcClientSecurityAutoConfiguration {
6062
@ConditionalOnSingleCandidate(CallCredentials.class)
6163
@Bean
6264
StubTransformer stubCallCredentialsTransformer(final CallCredentials credentials) {
65+
log.info("Found single CallCredentials in the context, automatically using it for all stubs");
6366
return CallCredentialsHelper.fixedCredentialsStubTransformer(credentials);
6467
}
6568

grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/security/CallCredentialsHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public void thisUsesUnstableApi() {} // API evolution in progress
266266

267267
@Override
268268
public String toString() {
269-
return "StaticSecurityHeaderCallCredentials [extraHeaders=" + this.extraHeaders + "]";
269+
return "StaticSecurityHeaderCallCredentials [extraHeaders.keys=" + this.extraHeaders.keys() + "]";
270270
}
271271

272272
}

0 commit comments

Comments
 (0)