Skip to content

Commit

Permalink
KEYCLOAK-3635 Not possible to filter debug/trace logging
Browse files Browse the repository at this point in the history
  • Loading branch information
stianst committed Oct 17, 2016
1 parent 4593d89 commit b320eb8
Show file tree
Hide file tree
Showing 94 changed files with 270 additions and 280 deletions.
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication; package org.keycloak.authentication;


import org.jboss.logging.Logger;
import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpRequest;
import org.keycloak.OAuth2Constants; import org.keycloak.OAuth2Constants;
import org.keycloak.authentication.authenticators.browser.AbstractUsernameFormAuthenticator; import org.keycloak.authentication.authenticators.browser.AbstractUsernameFormAuthenticator;
Expand Down Expand Up @@ -63,7 +64,7 @@
*/ */
public class AuthenticationProcessor { public class AuthenticationProcessor {
public static final String CURRENT_AUTHENTICATION_EXECUTION = "current.authentication.execution"; public static final String CURRENT_AUTHENTICATION_EXECUTION = "current.authentication.execution";
protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER; protected static final Logger logger = Logger.getLogger(AuthenticationProcessor.class);
protected RealmModel realm; protected RealmModel realm;
protected UserSessionModel userSession; protected UserSessionModel userSession;
protected ClientSessionModel clientSession; protected ClientSessionModel clientSession;
Expand Down Expand Up @@ -561,25 +562,25 @@ public Response handleBrowserException(Exception failure) {
if (failure instanceof AuthenticationFlowException) { if (failure instanceof AuthenticationFlowException) {
AuthenticationFlowException e = (AuthenticationFlowException) failure; AuthenticationFlowException e = (AuthenticationFlowException) failure;
if (e.getError() == AuthenticationFlowError.INVALID_USER) { if (e.getError() == AuthenticationFlowError.INVALID_USER) {
logger.failedAuthentication(e); ServicesLogger.LOGGER.failedAuthentication(e);
event.error(Errors.USER_NOT_FOUND); event.error(Errors.USER_NOT_FOUND);
return ErrorPage.error(session, Messages.INVALID_USER); return ErrorPage.error(session, Messages.INVALID_USER);
} else if (e.getError() == AuthenticationFlowError.USER_DISABLED) { } else if (e.getError() == AuthenticationFlowError.USER_DISABLED) {
logger.failedAuthentication(e); ServicesLogger.LOGGER.failedAuthentication(e);
event.error(Errors.USER_DISABLED); event.error(Errors.USER_DISABLED);
return ErrorPage.error(session, Messages.ACCOUNT_DISABLED); return ErrorPage.error(session, Messages.ACCOUNT_DISABLED);
} else if (e.getError() == AuthenticationFlowError.USER_TEMPORARILY_DISABLED) { } else if (e.getError() == AuthenticationFlowError.USER_TEMPORARILY_DISABLED) {
logger.failedAuthentication(e); ServicesLogger.LOGGER.failedAuthentication(e);
event.error(Errors.USER_TEMPORARILY_DISABLED); event.error(Errors.USER_TEMPORARILY_DISABLED);
return ErrorPage.error(session, Messages.INVALID_USER); return ErrorPage.error(session, Messages.INVALID_USER);


} else if (e.getError() == AuthenticationFlowError.INVALID_CLIENT_SESSION) { } else if (e.getError() == AuthenticationFlowError.INVALID_CLIENT_SESSION) {
logger.failedAuthentication(e); ServicesLogger.LOGGER.failedAuthentication(e);
event.error(Errors.INVALID_CODE); event.error(Errors.INVALID_CODE);
return ErrorPage.error(session, Messages.INVALID_CODE); return ErrorPage.error(session, Messages.INVALID_CODE);


} else if (e.getError() == AuthenticationFlowError.EXPIRED_CODE) { } else if (e.getError() == AuthenticationFlowError.EXPIRED_CODE) {
logger.failedAuthentication(e); ServicesLogger.LOGGER.failedAuthentication(e);
event.error(Errors.EXPIRED_CODE); event.error(Errors.EXPIRED_CODE);
return ErrorPage.error(session, Messages.EXPIRED_CODE); return ErrorPage.error(session, Messages.EXPIRED_CODE);


Expand All @@ -604,13 +605,13 @@ public Response handleBrowserException(Exception failure) {
return processor.authenticate(); return processor.authenticate();


} else { } else {
logger.failedAuthentication(e); ServicesLogger.LOGGER.failedAuthentication(e);
event.error(Errors.INVALID_USER_CREDENTIALS); event.error(Errors.INVALID_USER_CREDENTIALS);
return ErrorPage.error(session, Messages.INVALID_USER); return ErrorPage.error(session, Messages.INVALID_USER);
} }


} else { } else {
logger.failedAuthentication(failure); ServicesLogger.LOGGER.failedAuthentication(failure);
event.error(Errors.INVALID_USER_CREDENTIALS); event.error(Errors.INVALID_USER_CREDENTIALS);
return ErrorPage.error(session, Messages.UNEXPECTED_ERROR_HANDLING_REQUEST); return ErrorPage.error(session, Messages.UNEXPECTED_ERROR_HANDLING_REQUEST);
} }
Expand All @@ -620,7 +621,7 @@ public Response handleBrowserException(Exception failure) {
public Response handleClientAuthException(Exception failure) { public Response handleClientAuthException(Exception failure) {
if (failure instanceof AuthenticationFlowException) { if (failure instanceof AuthenticationFlowException) {
AuthenticationFlowException e = (AuthenticationFlowException) failure; AuthenticationFlowException e = (AuthenticationFlowException) failure;
logger.failedClientAuthentication(e); ServicesLogger.LOGGER.failedClientAuthentication(e);
if (e.getError() == AuthenticationFlowError.CLIENT_NOT_FOUND) { if (e.getError() == AuthenticationFlowError.CLIENT_NOT_FOUND) {
event.error(Errors.CLIENT_NOT_FOUND); event.error(Errors.CLIENT_NOT_FOUND);
return ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "invalid_client", "Could not find client"); return ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "invalid_client", "Could not find client");
Expand All @@ -635,7 +636,7 @@ public Response handleClientAuthException(Exception failure) {
return ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "unauthorized_client", e.getError().toString() + ": " + e.getMessage()); return ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "unauthorized_client", e.getError().toString() + ": " + e.getMessage());
} }
} else { } else {
logger.errorAuthenticatingClient(failure); ServicesLogger.LOGGER.errorAuthenticatingClient(failure);
event.error(Errors.INVALID_CLIENT_CREDENTIALS); event.error(Errors.INVALID_CLIENT_CREDENTIALS);
return ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "unauthorized_client", "Unexpected error when authenticating client: " + failure.getMessage()); return ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "unauthorized_client", "Unexpected error when authenticating client: " + failure.getMessage());
} }
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication; package org.keycloak.authentication;


import org.jboss.logging.Logger;
import org.keycloak.events.Details; import org.keycloak.events.Details;
import org.keycloak.events.Errors; import org.keycloak.events.Errors;
import org.keycloak.models.AuthenticationExecutionModel; import org.keycloak.models.AuthenticationExecutionModel;
Expand All @@ -35,7 +36,7 @@
*/ */
public class ClientAuthenticationFlow implements AuthenticationFlow { public class ClientAuthenticationFlow implements AuthenticationFlow {


protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static final Logger logger = Logger.getLogger(ClientAuthenticationFlow.class);


Response alternativeChallenge = null; Response alternativeChallenge = null;
AuthenticationProcessor processor; AuthenticationProcessor processor;
Expand Down Expand Up @@ -73,7 +74,7 @@ public Response processFlow() {
// Fallback to secret just in case (for backwards compatibility) // Fallback to secret just in case (for backwards compatibility)
if (expectedClientAuthType == null) { if (expectedClientAuthType == null) {
expectedClientAuthType = KeycloakModelUtils.getDefaultClientAuthenticatorType(); expectedClientAuthType = KeycloakModelUtils.getDefaultClientAuthenticatorType();
logger.authMethodFallback(client.getClientId(), expectedClientAuthType); ServicesLogger.LOGGER.authMethodFallback(client.getClientId(), expectedClientAuthType);
} }


// Check if client authentication matches // Check if client authentication matches
Expand Down Expand Up @@ -154,7 +155,7 @@ protected Response processResult(AuthenticationProcessor.Result result) {
} else if (status == FlowStatus.FAILURE_CHALLENGE) { } else if (status == FlowStatus.FAILURE_CHALLENGE) {
return sendChallenge(result, execution); return sendChallenge(result, execution);
} else { } else {
logger.unknownResultStatus(); ServicesLogger.LOGGER.unknownResultStatus();
throw new AuthenticationFlowException(AuthenticationFlowError.INTERNAL_ERROR); throw new AuthenticationFlowException(AuthenticationFlowError.INTERNAL_ERROR);
} }
} }
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication; package org.keycloak.authentication;


import org.jboss.logging.Logger;
import org.keycloak.models.AuthenticationExecutionModel; import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.AuthenticationFlowModel; import org.keycloak.models.AuthenticationFlowModel;
import org.keycloak.models.ClientSessionModel; import org.keycloak.models.ClientSessionModel;
Expand All @@ -32,7 +33,7 @@
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class DefaultAuthenticationFlow implements AuthenticationFlow { public class DefaultAuthenticationFlow implements AuthenticationFlow {
protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static final Logger logger = Logger.getLogger(DefaultAuthenticationFlow.class);
Response alternativeChallenge = null; Response alternativeChallenge = null;
AuthenticationExecutionModel challengedAlternativeExecution = null; AuthenticationExecutionModel challengedAlternativeExecution = null;
boolean alternativeSuccessful = false; boolean alternativeSuccessful = false;
Expand Down Expand Up @@ -247,7 +248,7 @@ public Response processResult(AuthenticationProcessor.Result result) {
return processor.authenticate(); return processor.authenticate();
default: default:
logger.debugv("authenticator INTERNAL_ERROR: {0}", execution.getAuthenticator()); logger.debugv("authenticator INTERNAL_ERROR: {0}", execution.getAuthenticator());
logger.unknownResultStatus(); ServicesLogger.LOGGER.unknownResultStatus();
throw new AuthenticationFlowException(AuthenticationFlowError.INTERNAL_ERROR); throw new AuthenticationFlowException(AuthenticationFlowError.INTERNAL_ERROR);
} }
} }
Expand Down
Expand Up @@ -39,15 +39,13 @@
*/ */
public class IdpConfirmLinkAuthenticator extends AbstractIdpAuthenticator { public class IdpConfirmLinkAuthenticator extends AbstractIdpAuthenticator {


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;

@Override @Override
protected void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext) { protected void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext) {
ClientSessionModel clientSession = context.getClientSession(); ClientSessionModel clientSession = context.getClientSession();


String existingUserInfo = clientSession.getNote(EXISTING_USER_INFO); String existingUserInfo = clientSession.getNote(EXISTING_USER_INFO);
if (existingUserInfo == null) { if (existingUserInfo == null) {
logger.noDuplicationDetected(); ServicesLogger.LOGGER.noDuplicationDetected();
context.attempted(); context.attempted();
return; return;
} }
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication.authenticators.broker; package org.keycloak.authentication.authenticators.broker;


import org.jboss.logging.Logger;
import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.authenticators.broker.util.ExistingUserInfo; import org.keycloak.authentication.authenticators.broker.util.ExistingUserInfo;
import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext; import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext;
Expand All @@ -39,7 +40,7 @@
*/ */
public class IdpCreateUserIfUniqueAuthenticator extends AbstractIdpAuthenticator { public class IdpCreateUserIfUniqueAuthenticator extends AbstractIdpAuthenticator {


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static Logger logger = Logger.getLogger(IdpCreateUserIfUniqueAuthenticator.class);




@Override @Override
Expand All @@ -59,7 +60,7 @@ protected void authenticateImpl(AuthenticationFlowContext context, SerializedBro


String username = getUsername(context, serializedCtx, brokerContext); String username = getUsername(context, serializedCtx, brokerContext);
if (username == null) { if (username == null) {
logger.resetFlow(realm.isRegistrationEmailAsUsername() ? "Email" : "Username"); ServicesLogger.LOGGER.resetFlow(realm.isRegistrationEmailAsUsername() ? "Email" : "Username");
context.getClientSession().setNote(ENFORCE_UPDATE_PROFILE, "true"); context.getClientSession().setNote(ENFORCE_UPDATE_PROFILE, "true");
context.resetFlow(); context.resetFlow();
return; return;
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication.authenticators.broker; package org.keycloak.authentication.authenticators.broker;


import org.jboss.logging.Logger;
import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError; import org.keycloak.authentication.AuthenticationFlowError;
import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext; import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext;
Expand Down Expand Up @@ -48,7 +49,7 @@
*/ */
public class IdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator { public class IdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator {


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static Logger logger = Logger.getLogger(IdpEmailVerificationAuthenticator.class);


@Override @Override
protected void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext) { protected void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext) {
Expand All @@ -57,7 +58,7 @@ protected void authenticateImpl(AuthenticationFlowContext context, SerializedBro
ClientSessionModel clientSession = context.getClientSession(); ClientSessionModel clientSession = context.getClientSession();


if (realm.getSmtpConfig().size() == 0) { if (realm.getSmtpConfig().size() == 0) {
logger.smtpNotConfigured(); ServicesLogger.LOGGER.smtpNotConfigured();
context.attempted(); context.attempted();
return; return;
} }
Expand Down Expand Up @@ -94,7 +95,7 @@ protected void authenticateImpl(AuthenticationFlowContext context, SerializedBro
} catch (EmailException e) { } catch (EmailException e) {
event.error(Errors.EMAIL_SEND_FAILED); event.error(Errors.EMAIL_SEND_FAILED);


logger.confirmBrokerEmailFailed(e); ServicesLogger.LOGGER.confirmBrokerEmailFailed(e);
Response challenge = context.form() Response challenge = context.form()
.setError(Messages.EMAIL_SENT_ERROR) .setError(Messages.EMAIL_SENT_ERROR)
.createErrorPage(); .createErrorPage();
Expand Down Expand Up @@ -137,7 +138,7 @@ protected void actionImpl(AuthenticationFlowContext context, SerializedBrokeredI
context.setUser(existingUser); context.setUser(existingUser);
context.success(); context.success();
} else { } else {
logger.keyParamDoesNotMatch(); ServicesLogger.LOGGER.keyParamDoesNotMatch();
Response challengeResponse = context.form() Response challengeResponse = context.form()
.setError(Messages.INVALID_ACCESS_CODE) .setError(Messages.INVALID_ACCESS_CODE)
.createErrorPage(); .createErrorPage();
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication.authenticators.broker; package org.keycloak.authentication.authenticators.broker;


import org.jboss.logging.Logger;
import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext; import org.keycloak.authentication.authenticators.broker.util.SerializedBrokeredIdentityContext;
import org.keycloak.broker.provider.BrokeredIdentityContext; import org.keycloak.broker.provider.BrokeredIdentityContext;
Expand Down Expand Up @@ -45,7 +46,7 @@
*/ */
public class IdpReviewProfileAuthenticator extends AbstractIdpAuthenticator { public class IdpReviewProfileAuthenticator extends AbstractIdpAuthenticator {


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static final Logger logger = Logger.getLogger(IdpReviewProfileAuthenticator.class);


@Override @Override
public boolean requiresUser() { public boolean requiresUser() {
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication.authenticators.browser; package org.keycloak.authentication.authenticators.browser;


import org.jboss.logging.Logger;
import org.keycloak.authentication.AbstractFormAuthenticator; import org.keycloak.authentication.AbstractFormAuthenticator;
import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError; import org.keycloak.authentication.AuthenticationFlowError;
Expand All @@ -43,7 +44,7 @@
*/ */
public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuthenticator { public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuthenticator {


private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static final Logger logger = Logger.getLogger(AbstractUsernameFormAuthenticator.class);


public static final String REGISTRATION_FORM_ACTION = "registration_form"; public static final String REGISTRATION_FORM_ACTION = "registration_form";
public static final String ATTEMPTED_USERNAME = "ATTEMPTED_USERNAME"; public static final String ATTEMPTED_USERNAME = "ATTEMPTED_USERNAME";
Expand Down Expand Up @@ -131,7 +132,7 @@ public boolean validateUserAndPassword(AuthenticationFlowContext context, Multiv
try { try {
user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username); user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username);
} catch (ModelDuplicateException mde) { } catch (ModelDuplicateException mde) {
logger.modelDuplicateException(mde); ServicesLogger.LOGGER.modelDuplicateException(mde);


// Could happen during federation import // Could happen during federation import
if (mde.getDuplicateFieldName() != null && mde.getDuplicateFieldName().equals(UserModel.EMAIL)) { if (mde.getDuplicateFieldName() != null && mde.getDuplicateFieldName().equals(UserModel.EMAIL)) {
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication.authenticators.browser; package org.keycloak.authentication.authenticators.browser;


import org.jboss.logging.Logger;
import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpRequest;
import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError; import org.keycloak.authentication.AuthenticationFlowError;
Expand Down Expand Up @@ -44,7 +45,7 @@
*/ */
public class SpnegoAuthenticator extends AbstractUsernameFormAuthenticator implements Authenticator{ public class SpnegoAuthenticator extends AbstractUsernameFormAuthenticator implements Authenticator{
public static final String KERBEROS_DISABLED = "kerberos_disabled"; public static final String KERBEROS_DISABLED = "kerberos_disabled";
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static final Logger logger = Logger.getLogger(SpnegoAuthenticator.class);


@Override @Override
public boolean requiresUser() { public boolean requiresUser() {
Expand Down
Expand Up @@ -37,7 +37,7 @@
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class UsernamePasswordForm extends AbstractUsernameFormAuthenticator implements Authenticator { public class UsernamePasswordForm extends AbstractUsernameFormAuthenticator implements Authenticator {
protected static ServicesLogger log = ServicesLogger.ROOT_LOGGER; protected static ServicesLogger log = ServicesLogger.LOGGER;


@Override @Override
public void action(AuthenticationFlowContext context) { public void action(AuthenticationFlowContext context) {
Expand Down
Expand Up @@ -25,7 +25,6 @@
import org.keycloak.protocol.oidc.OIDCLoginProtocol; import org.keycloak.protocol.oidc.OIDCLoginProtocol;
import org.keycloak.provider.ProviderConfigProperty; import org.keycloak.provider.ProviderConfigProperty;
import org.keycloak.representations.idm.CredentialRepresentation; import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.services.ServicesLogger;
import org.keycloak.util.BasicAuthHelper; import org.keycloak.util.BasicAuthHelper;


import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.HttpHeaders;
Expand All @@ -49,8 +48,6 @@
*/ */
public class ClientIdAndSecretAuthenticator extends AbstractClientAuthenticator { public class ClientIdAndSecretAuthenticator extends AbstractClientAuthenticator {


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;

public static final String PROVIDER_ID = "client-secret"; public static final String PROVIDER_ID = "client-secret";


public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = { public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = {
Expand Down
Expand Up @@ -59,8 +59,6 @@
*/ */
public class JWTClientAuthenticator extends AbstractClientAuthenticator { public class JWTClientAuthenticator extends AbstractClientAuthenticator {


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;

public static final String PROVIDER_ID = "client-jwt"; public static final String PROVIDER_ID = "client-jwt";
public static final String ATTR_PREFIX = "jwt.credential"; public static final String ATTR_PREFIX = "jwt.credential";
public static final String CERTIFICATE_ATTR = "jwt.credential.certificate"; public static final String CERTIFICATE_ATTR = "jwt.credential.certificate";
Expand Down Expand Up @@ -156,7 +154,7 @@ public void authenticateClient(ClientAuthenticationFlowContext context) {


context.success(); context.success();
} catch (Exception e) { } catch (Exception e) {
logger.errorValidatingAssertion(e); ServicesLogger.LOGGER.errorValidatingAssertion(e);
Response challengeResponse = ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "unauthorized_client", "Client authentication with signed JWT failed: " + e.getMessage()); Response challengeResponse = ClientAuthUtil.errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "unauthorized_client", "Client authentication with signed JWT failed: " + e.getMessage());
context.failure(AuthenticationFlowError.INVALID_CLIENT_CREDENTIALS, challengeResponse); context.failure(AuthenticationFlowError.INVALID_CLIENT_CREDENTIALS, challengeResponse);
} }
Expand Down
Expand Up @@ -43,7 +43,6 @@
*/ */
public class ValidateUsername extends AbstractDirectGrantAuthenticator { public class ValidateUsername extends AbstractDirectGrantAuthenticator {


private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
public static final String PROVIDER_ID = "direct-grant-validate-username"; public static final String PROVIDER_ID = "direct-grant-validate-username";


@Override @Override
Expand All @@ -63,7 +62,7 @@ public void authenticate(AuthenticationFlowContext context) {
try { try {
user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username); user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username);
} catch (ModelDuplicateException mde) { } catch (ModelDuplicateException mde) {
logger.modelDuplicateException(mde); ServicesLogger.LOGGER.modelDuplicateException(mde);
Response challengeResponse = errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), "invalid_request", "Invalid user credentials"); Response challengeResponse = errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), "invalid_request", "Invalid user credentials");
context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse); context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
return; return;
Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication.authenticators.resetcred; package org.keycloak.authentication.authenticators.resetcred;


import org.jboss.logging.Logger;
import org.keycloak.Config; import org.keycloak.Config;
import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError; import org.keycloak.authentication.AuthenticationFlowError;
Expand Down Expand Up @@ -46,7 +47,7 @@
*/ */
public class ResetCredentialChooseUser implements Authenticator, AuthenticatorFactory { public class ResetCredentialChooseUser implements Authenticator, AuthenticatorFactory {


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static final Logger logger = Logger.getLogger(ResetCredentialChooseUser.class);


public static final String PROVIDER_ID = "reset-credentials-choose-user"; public static final String PROVIDER_ID = "reset-credentials-choose-user";


Expand Down
Expand Up @@ -17,6 +17,7 @@


package org.keycloak.authentication.authenticators.resetcred; package org.keycloak.authentication.authenticators.resetcred;


import org.jboss.logging.Logger;
import org.keycloak.Config; import org.keycloak.Config;
import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError; import org.keycloak.authentication.AuthenticationFlowError;
Expand Down Expand Up @@ -53,7 +54,7 @@
public class ResetCredentialEmail implements Authenticator, AuthenticatorFactory { public class ResetCredentialEmail implements Authenticator, AuthenticatorFactory {
public static final String RESET_CREDENTIAL_SECRET = "RESET_CREDENTIAL_SECRET"; public static final String RESET_CREDENTIAL_SECRET = "RESET_CREDENTIAL_SECRET";


protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER; private static final Logger logger = Logger.getLogger(ResetCredentialEmail.class);


public static final String PROVIDER_ID = "reset-credential-email"; public static final String PROVIDER_ID = "reset-credential-email";


Expand Down Expand Up @@ -100,7 +101,7 @@ public void authenticate(AuthenticationFlowContext context) {
.detail(Details.USERNAME, username) .detail(Details.USERNAME, username)
.user(user) .user(user)
.error(Errors.EMAIL_SEND_FAILED); .error(Errors.EMAIL_SEND_FAILED);
logger.failedToSendPwdResetEmail(e); ServicesLogger.LOGGER.failedToSendPwdResetEmail(e);
Response challenge = context.form() Response challenge = context.form()
.setError(Messages.EMAIL_SENT_ERROR) .setError(Messages.EMAIL_SENT_ERROR)
.createErrorPage(); .createErrorPage();
Expand Down

0 comments on commit b320eb8

Please sign in to comment.