KEYCLOAK-1280: i18n logging for
org.keycloak.authentication.authenticators.broker
This commit is contained in:
parent
3b4cb94ff1
commit
b1baea7023
5 changed files with 37 additions and 13 deletions
|
@ -3,7 +3,6 @@ package org.keycloak.authentication.authenticators.broker;
|
|||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.authentication.AuthenticationFlowContext;
|
||||
import org.keycloak.authentication.AuthenticationFlowError;
|
||||
import org.keycloak.authentication.AuthenticationFlowException;
|
||||
|
@ -15,6 +14,7 @@ import org.keycloak.models.ClientSessionModel;
|
|||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.messages.Messages;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ import org.keycloak.services.messages.Messages;
|
|||
*/
|
||||
public class IdpConfirmLinkAuthenticator extends AbstractIdpAuthenticator {
|
||||
|
||||
protected static Logger logger = Logger.getLogger(IdpConfirmLinkAuthenticator.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
@Override
|
||||
protected void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext) {
|
||||
|
@ -30,7 +30,7 @@ public class IdpConfirmLinkAuthenticator extends AbstractIdpAuthenticator {
|
|||
|
||||
String existingUserInfo = clientSession.getNote(EXISTING_USER_INFO);
|
||||
if (existingUserInfo == null) {
|
||||
logger.warnf("No duplication detected.");
|
||||
logger.noDuplicationDetected();
|
||||
context.attempted();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Map;
|
|||
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.authentication.AuthenticationFlowContext;
|
||||
import org.keycloak.authentication.authenticators.broker.util.ExistingUserInfo;
|
||||
import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext;
|
||||
|
@ -16,6 +15,7 @@ import org.keycloak.models.AuthenticatorConfigModel;
|
|||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.messages.Messages;
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ import org.keycloak.services.messages.Messages;
|
|||
*/
|
||||
public class IdpCreateUserIfUniqueAuthenticator extends AbstractIdpAuthenticator {
|
||||
|
||||
protected static Logger logger = Logger.getLogger(IdpCreateUserIfUniqueAuthenticator.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -43,7 +43,7 @@ public class IdpCreateUserIfUniqueAuthenticator extends AbstractIdpAuthenticator
|
|||
|
||||
String username = getUsername(context, serializedCtx, brokerContext);
|
||||
if (username == null) {
|
||||
logger.warnf("%s is null. Reset flow and enforce showing reviewProfile page", realm.isRegistrationEmailAsUsername() ? "Email" : "Username");
|
||||
logger.resetFlow(realm.isRegistrationEmailAsUsername() ? "Email" : "Username");
|
||||
context.getClientSession().setNote(ENFORCE_UPDATE_PROFILE, "true");
|
||||
context.resetFlow();
|
||||
return;
|
||||
|
|
|
@ -6,7 +6,6 @@ import javax.ws.rs.core.MultivaluedMap;
|
|||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.authentication.AuthenticationFlowContext;
|
||||
import org.keycloak.authentication.AuthenticationFlowError;
|
||||
import org.keycloak.authentication.requiredactions.VerifyEmail;
|
||||
|
@ -24,6 +23,7 @@ import org.keycloak.models.Constants;
|
|||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.messages.Messages;
|
||||
import org.keycloak.services.resources.LoginActionsService;
|
||||
|
||||
|
@ -32,7 +32,7 @@ import org.keycloak.services.resources.LoginActionsService;
|
|||
*/
|
||||
public class IdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator {
|
||||
|
||||
protected static Logger logger = Logger.getLogger(IdpEmailVerificationAuthenticator.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
@Override
|
||||
protected void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext) {
|
||||
|
@ -41,7 +41,7 @@ public class IdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator
|
|||
ClientSessionModel clientSession = context.getClientSession();
|
||||
|
||||
if (realm.getSmtpConfig().size() == 0) {
|
||||
logger.warnf("Smtp is not configured for the realm. Ignoring email verification authenticator");
|
||||
logger.smtpNotConfigured();
|
||||
context.attempted();
|
||||
return;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class IdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator
|
|||
} catch (EmailException e) {
|
||||
event.error(Errors.EMAIL_SEND_FAILED);
|
||||
|
||||
logger.error("Failed to send email to confirm identity broker linking", e);
|
||||
logger.confirmBrokerEmailFailed(e);
|
||||
Response challenge = context.form()
|
||||
.setError(Messages.EMAIL_SENT_ERROR)
|
||||
.createErrorPage();
|
||||
|
@ -118,7 +118,7 @@ public class IdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator
|
|||
context.setUser(existingUser);
|
||||
context.success();
|
||||
} else {
|
||||
logger.error("Key parameter don't match with the expected value from client session");
|
||||
logger.keyParamDoesNotMatch();
|
||||
Response challengeResponse = context.form()
|
||||
.setError(Messages.INVALID_ACCESS_CODE)
|
||||
.createErrorPage();
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.authentication.AuthenticationFlowContext;
|
||||
import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext;
|
||||
import org.keycloak.broker.provider.BrokeredIdentityContext;
|
||||
|
@ -21,6 +20,7 @@ import org.keycloak.models.RealmModel;
|
|||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.models.utils.FormMessage;
|
||||
import org.keycloak.representations.idm.IdentityProviderRepresentation;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.resources.AttributeFormDataProcessor;
|
||||
import org.keycloak.services.validation.Validation;
|
||||
|
||||
|
@ -29,7 +29,7 @@ import org.keycloak.services.validation.Validation;
|
|||
*/
|
||||
public class IdpReviewProfileAuthenticator extends AbstractIdpAuthenticator {
|
||||
|
||||
protected static Logger logger = Logger.getLogger(IdpReviewProfileAuthenticator.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
@Override
|
||||
public boolean requiresUser() {
|
||||
|
|
|
@ -110,4 +110,28 @@ public interface ServicesLogger extends BasicLogger {
|
|||
@LogMessage(level = WARN)
|
||||
@Message(id=18, value="Client %s doesn't have have authentication method configured. Fallback to %s")
|
||||
void authMethodFallback(String clientId, String expectedClientAuthType);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=19, value="No duplication detected.")
|
||||
void noDuplicationDetected();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=20, value="%s is null. Reset flow and enforce showing reviewProfile page")
|
||||
void resetFlow(String emailOrUserName);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=21, value="Failed to send email to confirm identity broker linking")
|
||||
void confirmBrokerEmailFailed(@Cause Throwable t);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=22, value="Key parameter don't match with the expected value from client session")
|
||||
void keyParamDoesNotMatch();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue