From c852d6d817fd5c252f28cf1c5997b04d4ded0eb4 Mon Sep 17 00:00:00 2001 From: Thomas Darimont Date: Mon, 3 Oct 2016 13:33:53 +0200 Subject: [PATCH] KEYCLOAK-3642 Favor StreamUtil over IOUTils in ScriptBasedAuthenticatorFactory The dependency on commons-io through the use of IOUtils in ScriptBasedAuthenticatorFactory resulted in NoClassDefFoundError org/apache/commons/io/IOUtils when building the keycloak-distribution. We now use the StreamUtil from keycloak-common to avoid this dependency. --- .../browser/ScriptBasedAuthenticatorFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticatorFactory.java b/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticatorFactory.java index 0528154522..f9b2ff287a 100644 --- a/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticatorFactory.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticatorFactory.java @@ -16,11 +16,11 @@ */ package org.keycloak.authentication.authenticators.browser; -import org.apache.commons.io.IOUtils; import org.jboss.logging.Logger; import org.keycloak.Config; import org.keycloak.authentication.Authenticator; import org.keycloak.authentication.AuthenticatorFactory; +import org.keycloak.common.util.StreamUtil; import org.keycloak.models.AuthenticationExecutionModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; @@ -138,7 +138,7 @@ public class ScriptBasedAuthenticatorFactory implements AuthenticatorFactory { String scriptTemplate = "//enter your script code here"; try { - scriptTemplate = IOUtils.toString(getClass().getResource("/scripts/authenticator-template.js")); + scriptTemplate = StreamUtil.readString(getClass().getResourceAsStream("/scripts/authenticator-template.js")); } catch (IOException ioe) { LOGGER.warn(ioe); }