diff --git a/common/src/main/java/org/keycloak/common/util/SecretGenerator.java b/common/src/main/java/org/keycloak/common/util/SecretGenerator.java index ab5a220ba8..ff73e855ee 100644 --- a/common/src/main/java/org/keycloak/common/util/SecretGenerator.java +++ b/common/src/main/java/org/keycloak/common/util/SecretGenerator.java @@ -70,4 +70,4 @@ public class SecretGenerator { return buf; } -} \ No newline at end of file +} diff --git a/federation/sssd/src/main/java/org/keycloak/federation/sssd/SSSDFederationProviderFactory.java b/federation/sssd/src/main/java/org/keycloak/federation/sssd/SSSDFederationProviderFactory.java index 841e761e49..9330ea1e0e 100755 --- a/federation/sssd/src/main/java/org/keycloak/federation/sssd/SSSDFederationProviderFactory.java +++ b/federation/sssd/src/main/java/org/keycloak/federation/sssd/SSSDFederationProviderFactory.java @@ -97,4 +97,4 @@ public class SSSDFederationProviderFactory implements UserStorageProviderFactory public boolean isSupported() { return AvailabilityChecker.isAvailable(); } -} \ No newline at end of file +} diff --git a/server-spi/src/main/java/org/keycloak/utils/StringUtil.java b/server-spi/src/main/java/org/keycloak/utils/StringUtil.java index d1d8e39499..5879d425c3 100644 --- a/server-spi/src/main/java/org/keycloak/utils/StringUtil.java +++ b/server-spi/src/main/java/org/keycloak/utils/StringUtil.java @@ -28,6 +28,10 @@ public class StringUtil { return str != null && !"".equals(str.trim()); } + public static boolean isNullOrEmpty(String str) { + return str == null || str.isEmpty(); + } + /** * Calling: *
joinValuesWithLogicalCondition("or", Arrays.asList("foo", "bar", "baz", "caz" ))
@@ -52,4 +56,4 @@ public class StringUtil { return options.toString(); } -} \ No newline at end of file +} diff --git a/services/src/main/java/org/keycloak/authentication/AuthenticatorUtil.java b/services/src/main/java/org/keycloak/authentication/AuthenticatorUtil.java index f655d520b9..8d3b0d574f 100755 --- a/services/src/main/java/org/keycloak/authentication/AuthenticatorUtil.java +++ b/services/src/main/java/org/keycloak/authentication/AuthenticatorUtil.java @@ -17,7 +17,6 @@ package org.keycloak.authentication; -import com.google.common.collect.Sets; import org.jboss.logging.Logger; import org.keycloak.authentication.actiontoken.ActionTokenContext; import org.keycloak.authentication.actiontoken.DefaultActionToken; @@ -33,6 +32,7 @@ import org.keycloak.sessions.AuthenticationSessionModel; import org.keycloak.utils.StringUtil; import java.util.Collections; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Objects; @@ -94,7 +94,12 @@ public class AuthenticatorUtil { final String callbacksFactories = authSession.getAuthNote(CALLBACKS_FACTORY_IDS_NOTE); if (StringUtil.isNotBlank(callbacksFactories)) { - return Sets.newHashSet(callbacksFactories.split(Constants.CFG_DELIMITER)); + String[] split = callbacksFactories.split(Constants.CFG_DELIMITER); + Set set = new HashSet<>(split.length); + for (String s : split) { + set.add(s); + } + return Collections.unmodifiableSet(set); } else { return Collections.emptySet(); } diff --git a/services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java b/services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java index f30a64bdc0..895c6cd67e 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java @@ -17,7 +17,6 @@ package org.keycloak.protocol.oidc; -import com.google.common.collect.Streams; import org.keycloak.OAuth2Constants; import org.keycloak.authentication.ClientAuthenticator; import org.keycloak.authentication.ClientAuthenticatorFactory; @@ -242,7 +241,7 @@ public class OIDCWellKnownProvider implements WellKnownProvider { .map(ProviderFactory::getId); if (includeNone) { - supportedAlgorithms = Streams.concat(supportedAlgorithms, Stream.of("none")); + supportedAlgorithms = Stream.concat(supportedAlgorithms, Stream.of("none")); } return supportedAlgorithms.collect(Collectors.toList()); } diff --git a/services/src/main/java/org/keycloak/protocol/oidc/grants/ciba/CibaClientValidation.java b/services/src/main/java/org/keycloak/protocol/oidc/grants/ciba/CibaClientValidation.java index 9405a5fb6b..bcec5c9f9b 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc/grants/ciba/CibaClientValidation.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/grants/ciba/CibaClientValidation.java @@ -18,18 +18,11 @@ package org.keycloak.protocol.oidc.grants.ciba; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import com.google.common.collect.Streams; -import org.keycloak.crypto.ClientSignatureVerifierProvider; import org.keycloak.crypto.SignatureProvider; import org.keycloak.jose.jws.Algorithm; import org.keycloak.models.CibaConfig; import org.keycloak.models.ClientModel; import org.keycloak.models.KeycloakSession; -import org.keycloak.provider.ProviderFactory; -import org.keycloak.validation.DefaultClientValidationProvider; import org.keycloak.validation.ValidationContext; import static org.keycloak.common.util.UriUtils.checkUrl; diff --git a/services/src/main/java/org/keycloak/protocol/saml/DefaultSamlArtifactResolver.java b/services/src/main/java/org/keycloak/protocol/saml/DefaultSamlArtifactResolver.java index 63a8c522b7..dd5cdafd95 100644 --- a/services/src/main/java/org/keycloak/protocol/saml/DefaultSamlArtifactResolver.java +++ b/services/src/main/java/org/keycloak/protocol/saml/DefaultSamlArtifactResolver.java @@ -1,12 +1,12 @@ package org.keycloak.protocol.saml; -import com.google.common.base.Strings; import org.jboss.logging.Logger; import org.keycloak.models.AuthenticatedClientSessionModel; import org.keycloak.models.ClientModel; import org.keycloak.models.KeycloakSession; import org.keycloak.protocol.saml.util.ArtifactBindingUtils; import org.keycloak.saml.common.constants.GeneralConstants; +import org.keycloak.utils.StringUtil; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -35,7 +35,7 @@ public class DefaultSamlArtifactResolver implements ArtifactResolver { logger.tracef("Artifact response for artifact %s, is %s", artifact, artifactResponseString); - if (Strings.isNullOrEmpty(artifactResponseString)) { + if (StringUtil.isNullOrEmpty(artifactResponseString)) { throw new ArtifactResolverProcessingException("Artifact not present in ClientSession."); } diff --git a/services/src/main/java/org/keycloak/services/clientregistration/oidc/DescriptionConverter.java b/services/src/main/java/org/keycloak/services/clientregistration/oidc/DescriptionConverter.java index 24fed7768d..90a259ccec 100755 --- a/services/src/main/java/org/keycloak/services/clientregistration/oidc/DescriptionConverter.java +++ b/services/src/main/java/org/keycloak/services/clientregistration/oidc/DescriptionConverter.java @@ -17,7 +17,6 @@ package org.keycloak.services.clientregistration.oidc; -import com.google.common.collect.Streams; import org.keycloak.OAuth2Constants; import org.keycloak.authentication.ClientAuthenticator; import org.keycloak.authentication.ClientAuthenticatorFactory; @@ -274,7 +273,7 @@ public class DescriptionConverter { .map(ProviderFactory::getId); if (includeNone) { - supportedAlgorithms = Streams.concat(supportedAlgorithms, Stream.of("none")); + supportedAlgorithms = Stream.concat(supportedAlgorithms, Stream.of("none")); } return supportedAlgorithms.collect(Collectors.toList()); } diff --git a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java index e6d6081ced..e5ac4e0b13 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java @@ -18,7 +18,6 @@ package org.keycloak.services.resources.admin; import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; -import com.google.common.collect.Streams; import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.extensions.Extension; import org.eclipse.microprofile.openapi.annotations.parameters.Parameter; @@ -245,7 +244,7 @@ public class IdentityProviderResource { private IdentityProviderFactory getIdentityProviderFactory() { - return Streams.concat(session.getKeycloakSessionFactory().getProviderFactoriesStream(IdentityProvider.class), + return Stream.concat(session.getKeycloakSessionFactory().getProviderFactoriesStream(IdentityProvider.class), session.getKeycloakSessionFactory().getProviderFactoriesStream(SocialIdentityProvider.class)) .filter(providerFactory -> Objects.equals(providerFactory.getId(), identityProviderModel.getProviderId())) .map(IdentityProviderFactory.class::cast) diff --git a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java index 3b9ff801b1..31928aa8ed 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java @@ -17,7 +17,6 @@ package org.keycloak.services.resources.admin; -import com.google.common.collect.Streams; import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.extensions.Extension; import org.eclipse.microprofile.openapi.annotations.parameters.Parameter; @@ -281,7 +280,7 @@ public class IdentityProvidersResource { } private Stream getProviderFactories() { - return Streams.concat(session.getKeycloakSessionFactory().getProviderFactoriesStream(IdentityProvider.class), + return Stream.concat(session.getKeycloakSessionFactory().getProviderFactoriesStream(IdentityProvider.class), session.getKeycloakSessionFactory().getProviderFactoriesStream(SocialIdentityProvider.class)); }