From 7823156606ca541ef9cae7192b092efd2cfe4e9a Mon Sep 17 00:00:00 2001 From: exceptionfactory Date: Fri, 18 Mar 2022 11:46:43 -0500 Subject: [PATCH] NIFI-9815 Corrected log message formatting in multiple classes This closes #5879 Signed-off-by: Mike Thomsen --- .../main/java/org/apache/nifi/bootstrap/RunNiFi.java | 2 +- .../nifi/authorization/CompositeUserGroupProvider.java | 2 +- .../registry/extension/NiFiRegistryNarProvider.java | 2 +- .../apache/nifi/remote/SocketRemoteSiteListener.java | 2 +- .../protocol/AbstractFlowFileServerProtocol.java | 2 +- .../org/apache/nifi/web/api/DataTransferResource.java | 2 -- .../org/apache/nifi/web/api/OIDCAccessResource.java | 9 +++------ .../provenance/PersistentProvenanceRepository.java | 2 +- .../provenance/index/lucene/IndexDirectoryManager.java | 8 ++++---- .../nifi/registry/db/CustomFlywayConfiguration.java | 7 ++++--- .../provider/hook/ScriptEventHookProvider.java | 4 ++-- .../authorization/CompositeUserGroupProvider.java | 2 +- .../nifi/registry/service/AuthorizationService.java | 2 +- .../registry/properties/util/IdentityMappingUtil.java | 10 +++++----- .../kerberos/KerberosSpnegoIdentityProvider.java | 6 +----- .../org/apache/nifi/toolkit/tls/util/TlsHelper.java | 2 +- 16 files changed, 28 insertions(+), 36 deletions(-) diff --git a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java index 9fd972dada..9894b7fbef 100644 --- a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java +++ b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java @@ -1032,7 +1032,7 @@ public class RunNiFi { final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos); if (waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0) { if (isProcessRunning(pid, logger)) { - logger.warn("NiFi PID [{}] shutdown not completed after {} seconds: Killing process", gracefulShutdownSeconds); + logger.warn("NiFi PID [{}] shutdown not completed after {} seconds: Killing process", pid, gracefulShutdownSeconds); try { killProcessTree(pid, logger); } catch (final IOException ioe) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java index ca0888be78..a877d61f78 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java @@ -181,7 +181,7 @@ public class CompositeUserGroupProvider implements UserGroupProvider { compositeUserAndGroups.setUser(userAndGroups.getUser()); providerClassForUser = userGroupProvider.getClass().getName(); } else { - logger.warn("Multiple UserGroupProviders are claiming to provide user '{}': [{} and {}] ", + logger.warn("Multiple UserGroupProviders are claiming to provide identity [{}] user '{}': [{} and {}] ", identity, userAndGroups.getUser(), providerClassForUser, userGroupProvider.getClass().getName()); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/extension/NiFiRegistryNarProvider.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/extension/NiFiRegistryNarProvider.java index 6689d310c5..f8b8bffe8f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/extension/NiFiRegistryNarProvider.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/extension/NiFiRegistryNarProvider.java @@ -77,7 +77,7 @@ public class NiFiRegistryNarProvider implements NarProvider { final Set bundleMetadata = extensionRegistry.getExtensionBundleMetadata(null); return bundleMetadata.stream().map(bm -> bm.toLocationString()).collect(Collectors.toSet()); } catch (final ExtensionRegistryException ere) { - LOGGER.error("Unable to retrieve listing of NARs from NiFi Registry at []", extensionRegistry.getURL(), ere); + LOGGER.error("Unable to retrieve listing of NARs from NiFi Registry at [{}]", extensionRegistry.getURL(), ere); return Collections.emptySet(); } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java index a2d1d23703..5f0284addc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java @@ -172,7 +172,7 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { } } catch (final Exception e) { // TODO: Add SocketProtocolListener#handleTlsError logic here - String msg = String.format("RemoteSiteListener Unable to accept connection from {} due to {}", socket, e.getLocalizedMessage()); + String msg = String.format("RemoteSiteListener Unable to accept connection from %s due to %s", socket, e.getLocalizedMessage()); // Suppress repeated TLS errors if (CertificateUtils.isTlsError(e)) { boolean printedAsWarning = handleTlsError(msg); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java index b213640e93..e973797855 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java @@ -150,7 +150,7 @@ public abstract class AbstractFlowFileServerProtocol implements ServerProtocol { this.port = (PublicPort) receivedPort; final PortAuthorizationResult portAuthResult = this.port.checkUserAuthorization(peer.getCommunicationsSession().getUserDn()); if (!portAuthResult.isAuthorized()) { - logger.debug("Responding with ResponseCode UNAUTHORIZED: ", portAuthResult.getExplanation()); + logger.debug("Responding with ResponseCode UNAUTHORIZED: {}", portAuthResult.getExplanation()); throw new HandshakeException(ResponseCode.UNAUTHORIZED, portAuthResult.getExplanation()); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java index c8787d3a07..d474267174 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java @@ -197,8 +197,6 @@ public class DataTransferResource extends ApplicationResource { return validationResult.errResponse; } - logger.debug("createPortTransaction request: clientId={}, portType={}, portId={}", portType, portId); - final ByteArrayOutputStream out = new ByteArrayOutputStream(); final String transactionId = transactionManager.createTransaction(); final Peer peer = constructPeer(req, inputStream, out, portId, transactionId); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OIDCAccessResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OIDCAccessResource.java index 91523edd26..5fb766f2dd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OIDCAccessResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OIDCAccessResource.java @@ -81,9 +81,8 @@ import java.util.regex.Pattern; public class OIDCAccessResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(OIDCAccessResource.class); - private static final String OIDC_AUTHENTICATION_FAILED = "OIDC authentication attempt failed: "; + private static final String OIDC_AUTHENTICATION_NOT_CONFIGURED = "OIDC authentication not configured"; private static final String OIDC_ID_TOKEN_AUTHN_ERROR = "Unable to exchange authorization for ID token: "; - private static final String OIDC_IS_NOT_CONFIGURED_MESSAGE = "OIDC is not configured."; private static final String OIDC_REQUEST_IDENTIFIER_NOT_FOUND = "The request identifier was not found in the request."; private static final String OIDC_FAILED_TO_PARSE_REDIRECT_URI = "Unable to parse the redirect URI from the OpenId Connect Provider. Unable to continue login/logout process."; private static final String REVOKE_ACCESS_TOKEN_LOGOUT = "oidc_access_token_logout"; @@ -193,7 +192,7 @@ public class OIDCAccessResource extends ApplicationResource { try { validateOidcConfiguration(); } catch (final AuthenticationNotSupportedException e) { - logger.debug(OIDC_AUTHENTICATION_FAILED, e.getMessage()); + logger.debug("OIDC authentication not supported", e); return Response.status(Response.Status.CONFLICT).entity(e.getMessage()).build(); } @@ -230,7 +229,6 @@ public class OIDCAccessResource extends ApplicationResource { try { validateOidcConfiguration(); } catch (final AuthenticationNotSupportedException e) { - logger.debug(OIDC_AUTHENTICATION_FAILED, e.getMessage()); throw e; } @@ -471,7 +469,6 @@ public class OIDCAccessResource extends ApplicationResource { try { validateOidcConfiguration(); } catch (final AuthenticationNotSupportedException e) { - logger.debug(OIDC_AUTHENTICATION_FAILED, e.getMessage()); forwardToMessagePage(httpServletRequest, httpServletResponse, pageTitle, e.getMessage()); throw e; } @@ -529,7 +526,7 @@ public class OIDCAccessResource extends ApplicationResource { // ensure OIDC is actually configured/enabled if (!oidcService.isOidcEnabled()) { - throw new AuthenticationNotSupportedException(OIDC_IS_NOT_CONFIGURED_MESSAGE); + throw new AuthenticationNotSupportedException(OIDC_AUTHENTICATION_NOT_CONFIGURED); } } diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java index fd3d22bb79..72d593dbb2 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java @@ -1590,7 +1590,7 @@ public class PersistentProvenanceRepository implements ProvenanceRepository { // we have all "partial" files and there is already a merged file. Delete the data from the index // because the merge file may not be fully merged. We will re-merge. logger.warn("Merged Journal File {} already exists; however, all partial journal files also exist " - + "so assuming that the merge did not finish. Repeating procedure in order to ensure consistency."); + + "so assuming that the merge did not finish. Repeating procedure in order to ensure consistency.", suggestedMergeFile); final DeleteIndexAction deleteAction = new DeleteIndexAction(this, indexConfig, getIndexManager()); try { diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java index 9f59d07608..7dc4e16861 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java @@ -455,13 +455,13 @@ public class IndexDirectoryManager { // We didn't find the old index directory. Just add the new index directory. final long timestamp = DirectoryUtils.getIndexTimestamp(indexDirectory); if (timestamp < 0) { - logger.debug("Attempted to replace old index directory {} with new index directory {} but the old index directory did not " + - "exist and could not determine timestamp for new index directory"); + logger.debug("Attempted to replace old index directory {} with new index directory but the old index directory did not " + + "exist and could not determine timestamp for new index directory", indexDirectory); } else { final String partitionName = getPartitionName(indexDirectory); if (partitionName == null) { - logger.debug("Attempted to replace old index directory {} with new index directory {} but the old index directory did not " + - "exist and could not determine partition name for new index directory"); + logger.debug("Attempted to replace old index directory {} with new index directory but the old index directory did not " + + "exist and could not determine partition name for new index directory", indexDirectory); } else { final IndexLocation indexLocation = new IndexLocation(indexDirectory, timestamp, partitionName); indexLocationByTimestamp.computeIfAbsent(timestamp, key -> new ArrayList<>()).add(indexLocation); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/CustomFlywayConfiguration.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/CustomFlywayConfiguration.java index 4eb3812d77..f473ef6708 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/CustomFlywayConfiguration.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/CustomFlywayConfiguration.java @@ -33,6 +33,7 @@ import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Arrays; @Configuration public class CustomFlywayConfiguration implements FlywayConfigurationCustomizer { @@ -58,13 +59,13 @@ public class CustomFlywayConfiguration implements FlywayConfigurationCustomizer LOGGER.info("Determined database type is {}", databaseType.getName()); if (databaseType.equals(new MySQLDatabaseType())) { - LOGGER.info("Setting migration locations to {}", LOCATIONS_MYSQL); + LOGGER.info("Setting migration locations to {}", Arrays.asList(LOCATIONS_MYSQL)); configuration.locations(LOCATIONS_MYSQL); } else if (databaseType.equals(new PostgreSQLDatabaseType())) { - LOGGER.info("Setting migration locations to {}", LOCATIONS_POSTGRES); + LOGGER.info("Setting migration locations to {}", Arrays.asList(LOCATIONS_POSTGRES)); configuration.locations(LOCATIONS_POSTGRES); } else { - LOGGER.info("Setting migration locations to {}", LOCATIONS_DEFAULT); + LOGGER.info("Setting migration locations to {}", Arrays.asList(LOCATIONS_DEFAULT)); configuration.locations(LOCATIONS_DEFAULT); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java index f96115e795..c3848cd1a7 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java @@ -63,7 +63,7 @@ public class ScriptEventHookProvider try { builder.start(); } catch (IOException e) { - LOGGER.error("Execution of {0} failed with: {1}", new Object[] { commandString, e.getLocalizedMessage() }, e); + LOGGER.error("Command Execution Failed: {}", commandString, e); } } @@ -93,7 +93,7 @@ public class ScriptEventHookProvider scriptFile = new File(scripPath); if(scriptFile.isFile() && scriptFile.canExecute()) { - LOGGER.info("Configured ScriptEventHookProvider with script {}", new Object[] {scriptFile.getAbsolutePath()}); + LOGGER.info("Configured ScriptEventHookProvider with script {}", scriptFile.getAbsolutePath()); } else { throw new ProviderCreationException("The script file " + scriptFile.getAbsolutePath() + " cannot be executed."); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/CompositeUserGroupProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/CompositeUserGroupProvider.java index 3d84c14b9f..a19020ab31 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/CompositeUserGroupProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/CompositeUserGroupProvider.java @@ -167,7 +167,7 @@ public class CompositeUserGroupProvider implements UserGroupProvider { compositeUserAndGroups.setUser(userAndGroups.getUser()); providerClassForUser = userGroupProvider.getClass().getName(); } else { - logger.warn("Multiple UserGroupProviders are claiming to provide user '{}': [{} and {}] ", + logger.warn("Multiple UserGroupProviders are claiming to provide identity [{}] user '{}': [{} and {}] ", identity, userAndGroups.getUser(), providerClassForUser, userGroupProvider.getClass().getName()); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/AuthorizationService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/AuthorizationService.java index 1a348c3cd6..13142c5e1c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/AuthorizationService.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/AuthorizationService.java @@ -333,7 +333,7 @@ public class AuthorizationService { final Group group = userGroupProvider.getGroup(identifier); if (group == null) { - LOGGER.warn("The specified user group id [{}] does not exist.", group.getIdentifier()); + LOGGER.warn("The specified user group id [{}] does not exist.", identifier); throw new ResourceNotFoundException("The specified user group ID does not exist in this registry."); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/util/IdentityMappingUtil.java b/nifi-registry/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/util/IdentityMappingUtil.java index d7c2709183..b78fa9b84a 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/util/IdentityMappingUtil.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-properties/src/main/java/org/apache/nifi/registry/properties/util/IdentityMappingUtil.java @@ -89,7 +89,7 @@ public class IdentityMappingUtil { final String identityPattern = properties.getProperty(propertyName); if (StringUtils.isBlank(identityPattern)) { - LOGGER.warn("{} Mapping property {} was found, but was empty", new Object[] {getSubject.get(), propertyName}); + LOGGER.warn("{} Mapping property {} was found, but was empty", getSubject.get(), propertyName); continue; } @@ -98,7 +98,7 @@ public class IdentityMappingUtil { if (StringUtils.isBlank(identityValue)) { LOGGER.warn("{} Mapping property {} was found, but corresponding value {} was not found", - new Object[]{propertyName, identityValueProperty}); + getSubject.get(), propertyName, identityValueProperty); continue; } @@ -106,7 +106,7 @@ public class IdentityMappingUtil { String rawIdentityTransform = properties.getProperty(identityTransformProperty); if (StringUtils.isBlank(rawIdentityTransform)) { - LOGGER.debug("{} Mapping property {} was found, but no transform was present. Using NONE.", new Object[] {getSubject.get(), propertyName}); + LOGGER.debug("{} Mapping property {} was found, but no transform was present. Using NONE.", getSubject.get(), propertyName); rawIdentityTransform = IdentityMapping.Transform.NONE.name(); } @@ -115,7 +115,7 @@ public class IdentityMappingUtil { identityTransform = Transform.valueOf(rawIdentityTransform); } catch (final IllegalArgumentException iae) { LOGGER.warn("{} Mapping property {} was found, but corresponding transform {} was not valid. Allowed values {}", - new Object[] {getSubject.get(), propertyName, rawIdentityTransform, StringUtils.join(Transform.values(), ", ")}); + getSubject.get(), propertyName, rawIdentityTransform, StringUtils.join(Transform.values(), ", ")); continue; } @@ -123,7 +123,7 @@ public class IdentityMappingUtil { mappings.add(identityMapping); LOGGER.debug("Found {} Mapping with key = {}, pattern = {}, value = {}, transform = {}", - new Object[] {getSubject.get(), key, identityPattern, identityValue, rawIdentityTransform}); + getSubject.get(), key, identityPattern, identityValue, rawIdentityTransform); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java index f44d766fa3..2dc074fd85 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java @@ -67,7 +67,7 @@ public class KerberosSpnegoIdentityProvider implements IdentityProvider { private static final String AUTHORIZATION = "Authorization"; private static final String AUTHORIZATION_NEGOTIATE = "Negotiate"; - private long expiration = TimeUnit.MILLISECONDS.convert(12, TimeUnit.HOURS);; + private long expiration = TimeUnit.MILLISECONDS.convert(12, TimeUnit.HOURS); private KerberosServiceAuthenticationProvider kerberosServiceAuthenticationProvider; private AuthenticationDetailsSource authenticationDetailsSource; @@ -106,10 +106,6 @@ public class KerberosSpnegoIdentityProvider implements IdentityProvider { logger.debug("Detected 'Authorization: Negotiate header in request {}", request.getRequestURL()); byte[] base64Token = headerValue.substring(headerValue.indexOf(" ") + 1).getBytes(StandardCharsets.UTF_8); byte[] kerberosTicket = Base64.decode(base64Token); - if (kerberosTicket != null) { - logger.debug("Successfully decoded SPNEGO/Kerberos ticket passed in Authorization: Negotiate header.", request.getRequestURL()); - } - return new AuthenticationRequest(null, kerberosTicket, authenticationDetailsSource.buildDetails(request)); } diff --git a/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/util/TlsHelper.java b/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/util/TlsHelper.java index c9c43de8b2..5fe7fb0ea4 100644 --- a/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/util/TlsHelper.java +++ b/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/util/TlsHelper.java @@ -281,7 +281,7 @@ public class TlsHelper { // Already in PKCS #1 format return getKeyPair((PEMKeyPair)parsedObject); } else { - logger.warn("Expected one of %s or %s but got %s", PrivateKeyInfo.class, PEMKeyPair.class, parsedObject.getClass()); + logger.warn("Expected one of {} or {} but got {}", PrivateKeyInfo.class, PEMKeyPair.class, parsedObject.getClass()); throw new IOException("Expected private key in PKCS #1 or PKCS #8 unencrypted format"); } }