You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/11/16 15:01:36 UTC

(logging-log4j2) 01/01: Merge remote-tracking branch `ppkarwasz/basic-auth` into `2.x` (#1970)

This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 819b73807ca7bb9955e037df8e40b92d7d296a9e
Merge: bbf94c47c7 ac29f8f6d9
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Thu Nov 16 16:01:34 2023 +0100

    Merge remote-tracking branch `ppkarwasz/basic-auth` into `2.x` (#1970)

 .../core/util/BasicAuthorizationProvider.java      | 23 ++++++++++++++++++++--
 .../.2.x.x/change_basic_auth_encoding.xml          | 10 ++++++++++
 src/site/_release-notes/_2.x.x.adoc                |  1 +
 .../markdown/log4j-spring-cloud-config-client.md   |  3 ++-
 src/site/xdoc/manual/configuration.xml.vm          |  8 ++++++++
 5 files changed, 42 insertions(+), 3 deletions(-)

diff --cc log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicAuthorizationProvider.java
index f5c2d5c27d,ebdf21b49b..a2cd99dcf3
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicAuthorizationProvider.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicAuthorizationProvider.java
@@@ -16,10 -16,12 +16,13 @@@
   */
  package org.apache.logging.log4j.core.util;
  
++import static java.nio.charset.StandardCharsets.UTF_8;
++
  import java.net.URLConnection;
+ import java.nio.charset.Charset;
+ import java.util.Base64;
 -
  import org.apache.logging.log4j.Logger;
  import org.apache.logging.log4j.status.StatusLogger;
- import org.apache.logging.log4j.util.Base64Util;
  import org.apache.logging.log4j.util.LoaderUtil;
  import org.apache.logging.log4j.util.PropertiesUtil;
  
@@@ -40,12 -49,17 +48,17 @@@ public class BasicAuthorizationProvide
      private String authString = null;
  
      public BasicAuthorizationProvider(final PropertiesUtil props) {
 -        final String userName = props.getStringProperty(PREFIXES, AUTH_USER_NAME,
 -                () -> props.getStringProperty(CONFIG_USER_NAME));
 -        String password = props.getStringProperty(PREFIXES, AUTH_PASSWORD,
 -                () -> props.getStringProperty(CONFIG_PASSWORD));
 -        final String decryptor = props.getStringProperty(PREFIXES, AUTH_PASSWORD_DECRYPTOR,
 -                () -> props.getStringProperty(PASSWORD_DECRYPTOR));
 +        final String userName =
 +                props.getStringProperty(PREFIXES, AUTH_USER_NAME, () -> props.getStringProperty(CONFIG_USER_NAME));
 +        String password =
 +                props.getStringProperty(PREFIXES, AUTH_PASSWORD, () -> props.getStringProperty(CONFIG_PASSWORD));
 +        final String decryptor = props.getStringProperty(
 +                PREFIXES, AUTH_PASSWORD_DECRYPTOR, () -> props.getStringProperty(PASSWORD_DECRYPTOR));
+         // Password encoding
+         Charset passwordCharset = props.getCharsetProperty(BASIC_AUTH_ENCODING);
+         if (passwordCharset == null) {
+             props.getCharsetProperty(SPRING_BASIC_AUTH_ENCODING, UTF_8);
+         }
          if (decryptor != null) {
              try {
                  final Object obj = LoaderUtil.newInstanceOf(decryptor);
diff --cc src/site/_release-notes/_2.x.x.adoc
index 72db2546c8,cbfc9a1a74..d5e1378be4
--- a/src/site/_release-notes/_2.x.x.adoc
+++ b/src/site/_release-notes/_2.x.x.adoc
@@@ -47,17 -47,27 +47,18 @@@ The module name of four bridges (`log4j
  === Changed
  
  * Change the order of evaluation of `FormattedMessage` formatters. Messages are evaluated using `java.util.Format` only if they don't comply to the `java.text.MessageFormat` or `ParameterizedMessage` format. (https://github.com/apache/logging-log4j2/issues/1223[1223])
 -* Change default encoding of HTTP Basic Authentication to UTF-8 and add `log4j2.configurationAuthorizationEncoding` property to overwrite it. (https://github.com/apache/logging-log4j2/issues/1961[1961])
 -* Fix MDC pattern converter causing issues for `%notEmpty` (https://github.com/apache/logging-log4j2/issues/1922[1922])
 -* Fix `NotSerializableException` when `Logger` is serialized with a `ReusableMessageFactory` (https://github.com/apache/logging-log4j2/issues/1884[1884])
 -* Update `co.elastic.clients:elasticsearch-java` to version `8.11.0` (https://github.com/apache/logging-log4j2/pull/1953[1953])
 -* Update `com.fasterxml.jackson:jackson-bom` to version `2.15.3` (https://github.com/apache/logging-log4j2/pull/1894[1894])
++* Change default encoding of HTTP Basic Authentication to UTF-8 and add `log4j2.configurationAuthorizationEncoding` property to overwrite it. (https://github.com/apache/logging-log4j2/issues/1970[1970])
 +* Update `com.fasterxml.jackson:jackson-bom` to version `2.16.0` (https://github.com/apache/logging-log4j2/pull/1974[1974])
  * Update `com.github.luben:zstd-jni` to version `1.5.5-10` (https://github.com/apache/logging-log4j2/pull/1940[1940])
  * Update `com.google.guava:guava` to version `32.1.3-jre` (https://github.com/apache/logging-log4j2/pull/1875[1875])
 -* Update `com.h2database:h2` to version `2.2.224` (https://github.com/apache/logging-log4j2/pull/1880[1880])
 -* Update `de.flapdoodle.embed:de.flapdoodle.embed.mongo` to version `4.9.0` (https://github.com/apache/logging-log4j2/pull/1945[1945])
 -* Update `de.flapdoodle.reverse:de.flapdoodle.reverse` to version `1.7.0` (https://github.com/apache/logging-log4j2/pull/1965[1965])
  * Update `io.netty:netty-bom` to version `4.1.101.Final` (https://github.com/apache/logging-log4j2/pull/1960[1960])
 -* Update `net.bytebuddy:byte-buddy` to version `1.14.9` (https://github.com/apache/logging-log4j2/pull/1891[1891])
  * Update `org.eclipse.persistence:org.eclipse.persistence.jpa` to version `2.7.13` (https://github.com/apache/logging-log4j2/pull/1900[1900])
  * Update `org.fusesource.jansi:jansi` to version `2.4.1` (https://github.com/apache/logging-log4j2/pull/1907[1907])
 -* Update `org.junit:junit-bom` to version `5.10.1` (https://github.com/apache/logging-log4j2/pull/1944[1944])
  * Update `org.mongodb:bson` to version `4.11.1` (https://github.com/apache/logging-log4j2/pull/1957[1957])
 -* Update `org.ow2.asm:asm-bom` to version `9.6` (https://github.com/apache/logging-log4j2/pull/1898[1898])
 +* Update `org.springframework:spring-framework-bom` to version `5.3.30`
  * Update `org.springframework.boot:spring-boot` to version `2.7.17` (https://github.com/apache/logging-log4j2/pull/1874[1874])
 +* Update `org.springframework:spring-framework-bom` to version `5.3.31` (https://github.com/apache/logging-log4j2/pull/1973[1973])
  * Update `org.zeromq:jeromq` to version `0.5.4` (https://github.com/apache/logging-log4j2/pull/1878[1878])
 -* Update `uk.org.webcompere:system-stubs-core` to version `2.0.3` (https://github.com/apache/logging-log4j2/pull/1892[1892])
 -* Update Spring Framework from version 5.3.29 to 5.3.30;
  
  === Removed