org.testcontainers.utility.AuthConfigUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testcontainers Show documentation
Show all versions of testcontainers Show documentation
Isolated container management for Java code testing
The newest version!
package org.testcontainers.utility;
import com.github.dockerjava.api.model.AuthConfig;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import lombok.experimental.UtilityClass;
import org.jetbrains.annotations.NotNull;
/**
* TODO: Javadocs
*/
@UtilityClass
public class AuthConfigUtil {
public static String toSafeString(AuthConfig authConfig) {
if (authConfig == null) {
return "null";
}
return MoreObjects
.toStringHelper(authConfig)
.add("username", authConfig.getUsername())
.add("password", obfuscated(authConfig.getPassword()))
.add("auth", obfuscated(authConfig.getAuth()))
.add("email", authConfig.getEmail())
.add("registryAddress", authConfig.getRegistryAddress())
.add("registryToken", obfuscated(authConfig.getRegistrytoken()))
.toString();
}
@NotNull
private static String obfuscated(String value) {
return Strings.isNullOrEmpty(value) ? "blank" : "hidden non-blank value";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy