KEYCLOAK-1280: i18n logging for org.keycloak.protocol.oidc
This commit is contained in:
parent
9dccd45543
commit
550e23c8f6
5 changed files with 24 additions and 11 deletions
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
package org.keycloak.protocol.oidc;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.OAuth2Constants;
|
||||
import org.keycloak.events.Details;
|
||||
import org.keycloak.events.EventBuilder;
|
||||
|
@ -37,6 +36,7 @@ import org.keycloak.protocol.oidc.utils.OIDCRedirectUriBuilder;
|
|||
import org.keycloak.protocol.oidc.utils.OIDCResponseMode;
|
||||
import org.keycloak.protocol.oidc.utils.OIDCResponseType;
|
||||
import org.keycloak.representations.AccessTokenResponse;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.managers.ClientSessionCode;
|
||||
import org.keycloak.services.managers.ResourceAdminManager;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class OIDCLoginProtocol implements LoginProtocol {
|
|||
|
||||
public static final String RESPONSE_MODE_PARAM = "response_mode";
|
||||
|
||||
private static final Logger log = Logger.getLogger(OIDCLoginProtocol.class);
|
||||
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
protected KeycloakSession session;
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class OIDCLoginProtocol implements LoginProtocol {
|
|||
String redirect = clientSession.getRedirectUri();
|
||||
OIDCRedirectUriBuilder redirectUri = OIDCRedirectUriBuilder.fromUri(redirect, responseMode);
|
||||
String state = clientSession.getNote(OIDCLoginProtocol.STATE_PARAM);
|
||||
log.debugv("redirectAccessCode: state: {0}", state);
|
||||
logger.debugv("redirectAccessCode: state: {0}", state);
|
||||
if (state != null)
|
||||
redirectUri.addParam(OAuth2Constants.STATE, state);
|
||||
|
||||
|
@ -203,7 +203,7 @@ public class OIDCLoginProtocol implements LoginProtocol {
|
|||
case PASSIVE_LOGIN_REQUIRED:
|
||||
return "login_required";
|
||||
default:
|
||||
log.warn("Untranslated protocol Error: " + error.name() + " so we return default SAML error");
|
||||
logger.untranslatedProtocol(error.name());
|
||||
return "access_denied";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.keycloak.protocol.oidc;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.constants.KerberosConstants;
|
||||
import org.keycloak.common.util.UriUtils;
|
||||
import org.keycloak.events.EventBuilder;
|
||||
|
@ -34,6 +33,7 @@ import org.keycloak.protocol.oidc.mappers.UserPropertyMapper;
|
|||
import org.keycloak.protocol.oidc.mappers.UserSessionNoteMapper;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.representations.idm.ClientTemplateRepresentation;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.managers.AuthenticationManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -50,7 +50,7 @@ import org.keycloak.protocol.oidc.mappers.UserAttributeMapper;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class OIDCLoginProtocolFactory extends AbstractLoginProtocolFactory {
|
||||
private static Logger logger = Logger.getLogger(OIDCLoginProtocolFactory.class);
|
||||
private static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
public static final String USERNAME = "username";
|
||||
public static final String EMAIL = "email";
|
||||
|
@ -195,7 +195,7 @@ public class OIDCLoginProtocolFactory extends AbstractLoginProtocolFactory {
|
|||
|
||||
// Backwards compatibility only
|
||||
if (rep.isDirectGrantsOnly() != null) {
|
||||
logger.warn("Using deprecated 'directGrantsOnly' configuration in JSON representation. It will be removed in future versions");
|
||||
logger.usingDeprecatedDirectGrantsOnly();
|
||||
newClient.setStandardFlowEnabled(!rep.isDirectGrantsOnly());
|
||||
newClient.setDirectAccessGrantsEnabled(rep.isDirectGrantsOnly());
|
||||
} else {
|
||||
|
|
4
services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocolService.java
Executable file → Normal file
4
services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocolService.java
Executable file → Normal file
|
@ -1,6 +1,5 @@
|
|||
package org.keycloak.protocol.oidc;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
||||
import org.jboss.resteasy.spi.ResteasyProviderFactory;
|
||||
import org.keycloak.OAuth2Constants;
|
||||
|
@ -16,6 +15,7 @@ import org.keycloak.protocol.oidc.endpoints.LogoutEndpoint;
|
|||
import org.keycloak.protocol.oidc.endpoints.TokenEndpoint;
|
||||
import org.keycloak.protocol.oidc.endpoints.UserInfoEndpoint;
|
||||
import org.keycloak.protocol.oidc.representations.JSONWebKeySet;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.resources.RealmsResource;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -37,7 +37,7 @@ import javax.ws.rs.core.UriInfo;
|
|||
*/
|
||||
public class OIDCLoginProtocolService {
|
||||
|
||||
protected static final Logger logger = Logger.getLogger(OIDCLoginProtocolService.class);
|
||||
protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
private RealmModel realm;
|
||||
private TokenManager tokenManager;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.keycloak.protocol.oidc;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.ClientConnection;
|
||||
import org.keycloak.OAuth2Constants;
|
||||
import org.keycloak.OAuthErrorException;
|
||||
|
@ -34,6 +33,7 @@ import org.keycloak.representations.AccessTokenResponse;
|
|||
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.managers.ClientSessionCode;
|
||||
import org.keycloak.services.managers.UserSessionManager;
|
||||
|
@ -59,7 +59,7 @@ import java.util.Set;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class TokenManager {
|
||||
protected static final Logger logger = Logger.getLogger(TokenManager.class);
|
||||
protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
public static void applyScope(RoleModel role, RoleModel scope, Set<RoleModel> visited, Set<RoleModel> requested) {
|
||||
if (visited.contains(scope)) return;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.keycloak.services;
|
||||
|
||||
import java.net.URI;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.annotations.Cause;
|
||||
|
@ -188,4 +189,16 @@ public interface ServicesLogger extends BasicLogger {
|
|||
@LogMessage(level = ERROR)
|
||||
@Message(id=38, value="Error importing roles")
|
||||
void roleImportError(@Cause Exception e);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=39, value="Untranslated protocol Error: %s so we return default SAML error")
|
||||
void untranslatedProtocol(String errorName);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=40, value="Using deprecated 'directGrantsOnly' configuration in JSON representation. It will be removed in future versions")
|
||||
void usingDeprecatedDirectGrantsOnly();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=41, value="Invoking deprecated endpoint %s")
|
||||
void invokingDeprecatedEndpoint(URI requestUri);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue