Merge pull request #3279 from thomasdarimont/issue/KEYCLOAK-3642-remove-dependency-on-commons-io

KEYCLOAK-3642 Favor StreamUtil over IOUTils in ScriptBasedAuthenticatorFactory
This commit is contained in:
Marek Posolda 2016-10-03 15:19:37 +02:00 committed by GitHub
commit d12f157299

View file

@ -16,11 +16,11 @@
*/ */
package org.keycloak.authentication.authenticators.browser; package org.keycloak.authentication.authenticators.browser;
import org.apache.commons.io.IOUtils;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.keycloak.Config; import org.keycloak.Config;
import org.keycloak.authentication.Authenticator; import org.keycloak.authentication.Authenticator;
import org.keycloak.authentication.AuthenticatorFactory; import org.keycloak.authentication.AuthenticatorFactory;
import org.keycloak.common.util.StreamUtil;
import org.keycloak.models.AuthenticationExecutionModel; import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.KeycloakSessionFactory;
@ -138,7 +138,7 @@ public class ScriptBasedAuthenticatorFactory implements AuthenticatorFactory {
String scriptTemplate = "//enter your script code here"; String scriptTemplate = "//enter your script code here";
try { try {
scriptTemplate = IOUtils.toString(getClass().getResource("/scripts/authenticator-template.js")); scriptTemplate = StreamUtil.readString(getClass().getResourceAsStream("/scripts/authenticator-template.js"));
} catch (IOException ioe) { } catch (IOException ioe) {
LOGGER.warn(ioe); LOGGER.warn(ioe);
} }