KEYCLOAK-1280: i18n logging for org.keycloak.protocol.oidc.endpoints
This commit is contained in:
parent
550e23c8f6
commit
adfc192877
4 changed files with 30 additions and 14 deletions
10
services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java
Executable file → Normal file
10
services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java
Executable file → Normal file
|
@ -4,7 +4,6 @@ import javax.ws.rs.GET;
|
|||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.authentication.AuthenticationProcessor;
|
||||
import org.keycloak.constants.AdapterConstants;
|
||||
import org.keycloak.events.Details;
|
||||
|
@ -24,6 +23,7 @@ import org.keycloak.protocol.oidc.utils.OIDCResponseMode;
|
|||
import org.keycloak.protocol.oidc.utils.OIDCResponseType;
|
||||
import org.keycloak.protocol.oidc.utils.RedirectUtils;
|
||||
import org.keycloak.services.ErrorPageException;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.Urls;
|
||||
import org.keycloak.services.managers.ClientSessionCode;
|
||||
import org.keycloak.services.messages.Messages;
|
||||
|
@ -34,7 +34,7 @@ import org.keycloak.services.resources.LoginActionsService;
|
|||
*/
|
||||
public class AuthorizationEndpoint extends AuthorizationEndpointBase {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AuthorizationEndpoint.class);
|
||||
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
public static final String CODE_AUTH_TYPE = "code";
|
||||
|
||||
|
@ -182,7 +182,7 @@ public class AuthorizationEndpoint extends AuthorizationEndpointBase {
|
|||
action = Action.CODE;
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
logger.error(iae.getMessage());
|
||||
logger.error(iae);
|
||||
event.error(Errors.INVALID_REQUEST);
|
||||
throw new ErrorPageException(session, Messages.INVALID_PARAMETER, OIDCLoginProtocol.RESPONSE_TYPE_PARAM);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class AuthorizationEndpoint extends AuthorizationEndpointBase {
|
|||
|
||||
// Disallowed by OIDC specs
|
||||
if (parsedResponseType.isImplicitOrHybridFlow() && parsedResponseMode == OIDCResponseMode.QUERY) {
|
||||
logger.error("Response_mode 'query' not allowed for implicit or hybrid flow");
|
||||
logger.responseModeQueryNotAllowed();
|
||||
event.error(Errors.INVALID_REQUEST);
|
||||
throw new ErrorPageException(session, Messages.INVALID_PARAMETER, OIDCLoginProtocol.RESPONSE_MODE_PARAM);
|
||||
}
|
||||
|
@ -277,4 +277,4 @@ public class AuthorizationEndpoint extends AuthorizationEndpointBase {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.keycloak.protocol.oidc.endpoints;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
||||
import org.jboss.resteasy.spi.HttpRequest;
|
||||
import org.keycloak.common.ClientConnection;
|
||||
|
@ -21,6 +20,7 @@ import org.keycloak.protocol.oidc.utils.RedirectUtils;
|
|||
import org.keycloak.representations.IDToken;
|
||||
import org.keycloak.representations.RefreshToken;
|
||||
import org.keycloak.services.ErrorResponseException;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.managers.AuthenticationManager;
|
||||
import org.keycloak.services.messages.Messages;
|
||||
import org.keycloak.services.resources.Cors;
|
||||
|
@ -43,7 +43,7 @@ import javax.ws.rs.core.UriInfo;
|
|||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class LogoutEndpoint {
|
||||
protected static Logger logger = Logger.getLogger(LogoutEndpoint.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
@Context
|
||||
private KeycloakSession session;
|
||||
|
|
14
services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java
Executable file → Normal file
14
services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java
Executable file → Normal file
|
@ -1,6 +1,5 @@
|
|||
package org.keycloak.protocol.oidc.endpoints;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.resteasy.spi.HttpRequest;
|
||||
import org.jboss.resteasy.spi.ResteasyProviderFactory;
|
||||
import org.keycloak.common.ClientConnection;
|
||||
|
@ -27,6 +26,7 @@ import org.keycloak.protocol.oidc.utils.AuthorizeClientUtil;
|
|||
import org.keycloak.representations.AccessToken;
|
||||
import org.keycloak.representations.AccessTokenResponse;
|
||||
import org.keycloak.services.ErrorResponseException;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.managers.AuthenticationManager;
|
||||
import org.keycloak.services.managers.ClientManager;
|
||||
import org.keycloak.services.managers.ClientSessionCode;
|
||||
|
@ -51,7 +51,7 @@ import java.util.Map;
|
|||
*/
|
||||
public class TokenEndpoint {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TokenEndpoint.class);
|
||||
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
private MultivaluedMap<String, String> formParams;
|
||||
private ClientModel client;
|
||||
private Map<String, String> clientAuthAttributes;
|
||||
|
@ -285,7 +285,7 @@ public class TokenEndpoint {
|
|||
private void updateClientSession(ClientSessionModel clientSession) {
|
||||
|
||||
if(clientSession == null) {
|
||||
logger.error("client session is null");
|
||||
logger.clientSessionNull();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -303,16 +303,16 @@ public class TokenEndpoint {
|
|||
|
||||
private void updateClientSessions(List<ClientSessionModel> clientSessions) {
|
||||
if(clientSessions == null) {
|
||||
logger.error("client sessions is null");
|
||||
logger.clientSessionNull();
|
||||
return;
|
||||
}
|
||||
for (ClientSessionModel clientSession : clientSessions) {
|
||||
if(clientSession == null) {
|
||||
logger.error("client session is null");
|
||||
logger.clientSessionNull();
|
||||
continue;
|
||||
}
|
||||
if(clientSession.getClient() == null) {
|
||||
logger.error("client model in client session is null");
|
||||
logger.clientModelNull();
|
||||
continue;
|
||||
}
|
||||
if(client.getId().equals(clientSession.getClient().getId())) {
|
||||
|
@ -448,4 +448,4 @@ public class TokenEndpoint {
|
|||
return Cors.add(request, Response.ok(res, MediaType.APPLICATION_JSON_TYPE)).auth().allowedOrigins(client).allowedMethods("POST").exposedHeaders(Cors.ACCESS_CONTROL_ALLOW_METHODS).build();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,4 +201,20 @@ public interface ServicesLogger extends BasicLogger {
|
|||
@LogMessage(level = WARN)
|
||||
@Message(id=41, value="Invoking deprecated endpoint %s")
|
||||
void invokingDeprecatedEndpoint(URI requestUri);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=42, value="Response_mode 'query' not allowed for implicit or hybrid flow")
|
||||
void responseModeQueryNotAllowed();
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=43, value="Client session is null")
|
||||
void clientSessionNull();
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=44, value="Client model in client session is null")
|
||||
void clientModelNull();
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=45, value="Invalid token. Token verification failed.")
|
||||
void invalidToken();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue