KEYCLOAK-1280: i18n logging for
org.keycloak.authentication.authenticators.client
This commit is contained in:
parent
0ef8c18b93
commit
36e711fb88
3 changed files with 9 additions and 5 deletions
|
@ -11,7 +11,6 @@ import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.MultivaluedMap;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.authentication.AuthenticationFlowError;
|
import org.keycloak.authentication.AuthenticationFlowError;
|
||||||
import org.keycloak.authentication.ClientAuthenticationFlowContext;
|
import org.keycloak.authentication.ClientAuthenticationFlowContext;
|
||||||
|
@ -19,6 +18,7 @@ import org.keycloak.models.AuthenticationExecutionModel;
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@ import org.keycloak.util.BasicAuthHelper;
|
||||||
*/
|
*/
|
||||||
public class ClientIdAndSecretAuthenticator extends AbstractClientAuthenticator {
|
public class ClientIdAndSecretAuthenticator extends AbstractClientAuthenticator {
|
||||||
|
|
||||||
protected static Logger logger = Logger.getLogger(ClientIdAndSecretAuthenticator.class);
|
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||||
|
|
||||||
public static final String PROVIDER_ID = "client-secret";
|
public static final String PROVIDER_ID = "client-secret";
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Map;
|
||||||
import javax.ws.rs.core.MultivaluedMap;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.authentication.AuthenticationFlowError;
|
import org.keycloak.authentication.AuthenticationFlowError;
|
||||||
import org.keycloak.authentication.ClientAuthenticationFlowContext;
|
import org.keycloak.authentication.ClientAuthenticationFlowContext;
|
||||||
|
@ -23,6 +22,7 @@ import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.provider.ProviderConfigProperty;
|
import org.keycloak.provider.ProviderConfigProperty;
|
||||||
import org.keycloak.representations.JsonWebToken;
|
import org.keycloak.representations.JsonWebToken;
|
||||||
|
import org.keycloak.services.ServicesLogger;
|
||||||
import org.keycloak.services.Urls;
|
import org.keycloak.services.Urls;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ import org.keycloak.services.Urls;
|
||||||
*/
|
*/
|
||||||
public class JWTClientAuthenticator extends AbstractClientAuthenticator {
|
public class JWTClientAuthenticator extends AbstractClientAuthenticator {
|
||||||
|
|
||||||
protected static Logger logger = Logger.getLogger(JWTClientAuthenticator.class);
|
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 CERTIFICATE_ATTR = "jwt.credential.certificate";
|
public static final String CERTIFICATE_ATTR = "jwt.credential.certificate";
|
||||||
|
@ -129,7 +129,7 @@ public class JWTClientAuthenticator extends AbstractClientAuthenticator {
|
||||||
|
|
||||||
context.success();
|
context.success();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error when validate client assertion", e);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,4 +135,8 @@ public interface ServicesLogger extends BasicLogger {
|
||||||
@LogMessage(level = ERROR)
|
@LogMessage(level = ERROR)
|
||||||
@Message(id=24, value="")
|
@Message(id=24, value="")
|
||||||
void modelDuplicateException(@Cause ModelDuplicateException mde);
|
void modelDuplicateException(@Cause ModelDuplicateException mde);
|
||||||
|
|
||||||
|
@LogMessage(level = ERROR)
|
||||||
|
@Message(id=25, value="Error when validating client assertion")
|
||||||
|
void errorValidatingAssertion(@Cause Throwable t);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue