KEYCLOAK-1280: i18n logging for

org.keycloak.services.authentication.authenticators.browser
This commit is contained in:
Stan Silvert 2016-01-18 13:04:15 -05:00
parent b1baea7023
commit 0ef8c18b93
4 changed files with 11 additions and 10 deletions

View file

@ -1,6 +1,5 @@
package org.keycloak.authentication.authenticators.browser;
import org.jboss.logging.Logger;
import org.keycloak.authentication.AbstractFormAuthenticator;
import org.keycloak.authentication.AuthenticationFlowError;
import org.keycloak.authentication.AuthenticationFlowContext;
@ -11,6 +10,7 @@ import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.utils.KeycloakModelUtils;
import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.services.ServicesLogger;
import org.keycloak.services.managers.AuthenticationManager;
import org.keycloak.services.messages.Messages;
@ -25,7 +25,7 @@ import java.util.List;
*/
public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuthenticator {
private static final Logger logger = Logger.getLogger(AbstractUsernameFormAuthenticator.class);
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
public static final String REGISTRATION_FORM_ACTION = "registration_form";
public static final String ATTEMPTED_USERNAME = "ATTEMPTED_USERNAME";
@ -109,7 +109,7 @@ public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuth
try {
user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username);
} catch (ModelDuplicateException mde) {
logger.error(mde.getMessage(), mde);
logger.modelDuplicateException(mde);
// Could happen during federation import
if (mde.getDuplicateFieldName() != null && mde.getDuplicateFieldName().equals(UserModel.EMAIL)) {

View file

@ -1,6 +1,5 @@
package org.keycloak.authentication.authenticators.browser;
import org.jboss.logging.Logger;
import org.jboss.resteasy.spi.HttpRequest;
import org.keycloak.authentication.AuthenticationFlowError;
import org.keycloak.authentication.AuthenticationFlowContext;
@ -13,6 +12,7 @@ import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserModel;
import org.keycloak.services.ServicesLogger;
import org.keycloak.services.messages.Messages;
import javax.ws.rs.core.HttpHeaders;
@ -27,7 +27,7 @@ import java.util.Map;
*/
public class SpnegoAuthenticator extends AbstractUsernameFormAuthenticator implements Authenticator{
public static final String KERBEROS_DISABLED = "kerberos_disabled";
protected static Logger logger = Logger.getLogger(SpnegoAuthenticator.class);
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
@Override
public boolean requiresUser() {

View file

@ -1,6 +1,5 @@
package org.keycloak.authentication.authenticators.browser;
import org.jboss.logging.Logger;
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationProcessor;
@ -10,6 +9,7 @@ import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
import org.keycloak.services.ServicesLogger;
import org.keycloak.services.managers.AuthenticationManager;
import javax.ws.rs.core.MultivaluedMap;
@ -20,7 +20,7 @@ import javax.ws.rs.core.Response;
* @version $Revision: 1 $
*/
public class UsernamePasswordForm extends AbstractUsernameFormAuthenticator implements Authenticator {
protected static Logger logger = Logger.getLogger(UsernamePasswordForm.class);
protected static ServicesLogger log = ServicesLogger.ROOT_LOGGER;
@Override
public void action(AuthenticationFlowContext context) {

View file

@ -27,6 +27,7 @@ import org.jboss.logging.annotations.MessageLogger;
import static org.jboss.logging.Logger.Level.ERROR;
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;
import org.keycloak.models.ModelDuplicateException;
/**
@ -131,7 +132,7 @@ public interface ServicesLogger extends BasicLogger {
@Message(id=23, value="Smtp is not configured for the realm. Ignoring email verification authenticator")
void smtpNotConfigured();
@LogMessage(level = WARN)
@Message(id=23, value="Smtp is not configured for the realm. Ignoring email verification authenticator")
void smtpNotConfigured();
@LogMessage(level = ERROR)
@Message(id=24, value="")
void modelDuplicateException(@Cause ModelDuplicateException mde);
}