KEYCLOAK-1280: i18n logging for org.keycloak.services.managers
This commit is contained in:
parent
c81b37cc4d
commit
779a5c2f3c
11 changed files with 218 additions and 39 deletions
|
@ -17,7 +17,9 @@
|
|||
|
||||
package org.keycloak.services;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import javax.naming.NamingException;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.annotations.Cause;
|
||||
|
@ -233,4 +235,56 @@ public interface ServicesLogger extends BasicLogger {
|
|||
@LogMessage(level = ERROR)
|
||||
@Message(id=49, value="%s")
|
||||
void clientRegistrationException(String message);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(id=50, value="Initializing %s realm")
|
||||
void initializingAdminRealm(String adminRealmName);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=51, value="Failed to logout client, continuing")
|
||||
void failedToLogoutClient(@Cause Exception e);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=52, value="Failed processing type")
|
||||
void failedProcessingType(@Cause Exception e);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=53, value="login failure for user %s from ip %s")
|
||||
void loginFailure(String user, String ip);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=54, value="Unknown action: %s")
|
||||
void unknownAction(String action);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=55, value="%s")
|
||||
void errorAuthenticating(@Cause Exception e, String message);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=56, value="Error when closing LDAP connection")
|
||||
void errorClosingLDAP(@Cause NamingException ne);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=57, value="Logout for client '%s' failed")
|
||||
void logoutFailed(@Cause IOException ioe, String clientId);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=58, value="Failed to send revocation request")
|
||||
void failedToSendRevocation(@Cause IOException ioe);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=59, value="Availability test failed for uri '%s'")
|
||||
void availabilityTestFailed(String managementUrl);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(id=60, value="Role '%s' not available in realm")
|
||||
void roleNotInRealm(String offlineAccessRole);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=61, value="Error occurred during full sync of users")
|
||||
void errorDuringFullUserSync(@Cause Throwable t);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=62, value="Error occurred during sync of changed users")
|
||||
void errorDuringChangedUserSync(@Cause Throwable t);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.resteasy.spi.UnauthorizedException;
|
||||
import org.keycloak.common.ClientConnection;
|
||||
import org.keycloak.models.KeycloakContext;
|
||||
|
@ -16,8 +31,6 @@ import javax.ws.rs.core.UriInfo;
|
|||
*/
|
||||
public class AppAuthManager extends AuthenticationManager {
|
||||
|
||||
protected static Logger logger = Logger.getLogger(AppAuthManager.class);
|
||||
|
||||
@Override
|
||||
public AuthResult authenticateIdentityCookie(KeycloakSession session, RealmModel realm) {
|
||||
AuthResult authResult = super.authenticateIdentityCookie(session, realm);
|
||||
|
|
|
@ -1,12 +1,28 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.Config;
|
||||
import org.keycloak.common.Version;
|
||||
import org.keycloak.common.enums.SslRequired;
|
||||
import org.keycloak.models.*;
|
||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
|
@ -14,7 +30,7 @@ import org.keycloak.representations.idm.CredentialRepresentation;
|
|||
*/
|
||||
public class ApplianceBootstrap {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ApplianceBootstrap.class);
|
||||
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
private final KeycloakSession session;
|
||||
|
||||
public ApplianceBootstrap(KeycloakSession session) {
|
||||
|
@ -40,7 +56,7 @@ public class ApplianceBootstrap {
|
|||
}
|
||||
|
||||
String adminRealmName = Config.getAdminRealm();
|
||||
logger.info("Initializing " + adminRealmName + " realm");
|
||||
logger.initializingAdminRealm(adminRealmName);
|
||||
|
||||
RealmManager manager = new RealmManager(session);
|
||||
manager.setContextPath(contextPath);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
|
||||
import org.jboss.resteasy.spi.HttpRequest;
|
||||
import org.keycloak.common.ClientConnection;
|
||||
|
@ -39,6 +38,7 @@ import org.keycloak.protocol.LoginProtocol;
|
|||
import org.keycloak.protocol.LoginProtocol.Error;
|
||||
import org.keycloak.protocol.oidc.TokenManager;
|
||||
import org.keycloak.representations.AccessToken;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.Urls;
|
||||
import org.keycloak.services.messages.Messages;
|
||||
import org.keycloak.services.resources.IdentityBrokerService;
|
||||
|
@ -60,7 +60,7 @@ import java.util.Set;
|
|||
*/
|
||||
public class AuthenticationManager {
|
||||
public static final String END_AFTER_REQUIRED_ACTIONS = "END_AFTER_REQUIRED_ACTIONS";
|
||||
protected static Logger logger = Logger.getLogger(AuthenticationManager.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
public static final String FORM_USERNAME = "username";
|
||||
// used for auth login
|
||||
public static final String KEYCLOAK_IDENTITY_COOKIE = "KEYCLOAK_IDENTITY";
|
||||
|
@ -195,7 +195,7 @@ public class AuthenticationManager {
|
|||
protocol.backchannelLogout(userSession, clientSession);
|
||||
clientSession.setAction(ClientSessionModel.Action.LOGGED_OUT.name());
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to logout client, continuing", e);
|
||||
logger.failedToLogoutClient(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public class AuthenticationManager {
|
|||
return response;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to logout client, continuing", e);
|
||||
logger.failedToLogoutClient(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
20
services/src/main/java/org/keycloak/services/managers/ClientManager.java
Executable file → Normal file
20
services/src/main/java/org/keycloak/services/managers/ClientManager.java
Executable file → Normal file
|
@ -1,8 +1,23 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.authentication.ClientAuthenticator;
|
||||
import org.keycloak.authentication.ClientAuthenticatorFactory;
|
||||
import org.keycloak.common.constants.ServiceAccountConstants;
|
||||
|
@ -21,6 +36,7 @@ import org.keycloak.protocol.oidc.mappers.UserSessionNoteMapper;
|
|||
import org.keycloak.representations.adapters.config.BaseRealmConfig;
|
||||
import org.keycloak.common.util.Time;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
|
@ -35,7 +51,7 @@ import java.util.TreeSet;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class ClientManager {
|
||||
protected Logger logger = Logger.getLogger(ClientManager.class);
|
||||
protected ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
protected RealmManager realmManager;
|
||||
|
||||
|
|
24
services/src/main/java/org/keycloak/services/managers/DefaultBruteForceProtector.java
Executable file → Normal file
24
services/src/main/java/org/keycloak/services/managers/DefaultBruteForceProtector.java
Executable file → Normal file
|
@ -1,12 +1,28 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.ClientConnection;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.KeycloakSessionFactory;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.UsernameLoginFailureModel;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -21,7 +37,7 @@ import java.util.concurrent.TimeUnit;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class DefaultBruteForceProtector implements Runnable, BruteForceProtector {
|
||||
protected static Logger logger = Logger.getLogger(DefaultBruteForceProtector.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
protected volatile boolean run = true;
|
||||
protected int maxDeltaTimeSeconds = 60 * 60 * 12; // 12 hours
|
||||
|
@ -178,7 +194,7 @@ public class DefaultBruteForceProtector implements Runnable, BruteForceProtector
|
|||
session.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed processing type", e);
|
||||
logger.failedProcessingType(e);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
break;
|
||||
|
@ -190,7 +206,7 @@ public class DefaultBruteForceProtector implements Runnable, BruteForceProtector
|
|||
}
|
||||
|
||||
protected void logFailure(LoginEvent event) {
|
||||
logger.warn("login failure for user " + event.username + " from ip " + event.ip);
|
||||
logger.loginFailure(event.username, event.ip);
|
||||
failures++;
|
||||
long delta = 0;
|
||||
if (lastFailure > 0) {
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
|
@ -12,14 +28,14 @@ import java.util.Hashtable;
|
|||
*/
|
||||
public class LDAPConnectionTestManager {
|
||||
|
||||
protected static final Logger logger = Logger.getLogger(LDAPConnectionTestManager.class);
|
||||
protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
public static final String TEST_CONNECTION = "testConnection";
|
||||
public static final String TEST_AUTHENTICATION = "testAuthentication";
|
||||
|
||||
public boolean testLDAP(String action, String connectionUrl, String bindDn, String bindCredential) {
|
||||
if (!TEST_CONNECTION.equals(action) && !TEST_AUTHENTICATION.equals(action)) {
|
||||
logger.error("Unknown action: " + action);
|
||||
logger.unknownAction(action);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -44,14 +60,14 @@ public class LDAPConnectionTestManager {
|
|||
return true;
|
||||
} catch (Exception ne) {
|
||||
String errorMessage = (TEST_AUTHENTICATION.equals(action)) ? "Error when authenticating to LDAP: " : "Error when connecting to LDAP: ";
|
||||
logger.error(errorMessage + ne.getMessage(), ne);
|
||||
logger.errorAuthenticating(ne, errorMessage + ne.getMessage());
|
||||
return false;
|
||||
} finally {
|
||||
if (ldapContext != null) {
|
||||
try {
|
||||
ldapContext.close();
|
||||
} catch (NamingException ne) {
|
||||
logger.warn("Error when closing LDAP connection", ne);
|
||||
logger.errorClosingLDAP(ne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.Config;
|
||||
import org.keycloak.common.enums.SslRequired;
|
||||
import org.keycloak.models.session.UserSessionPersisterProvider;
|
||||
|
@ -61,7 +60,6 @@ import org.keycloak.protocol.ProtocolMapperUtils;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class RealmManager implements RealmImporter {
|
||||
protected static final Logger logger = Logger.getLogger(RealmManager.class);
|
||||
|
||||
protected KeycloakSession session;
|
||||
protected RealmProvider model;
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.TokenIdGenerator;
|
||||
import org.keycloak.connections.httpclient.HttpClientProvider;
|
||||
import org.keycloak.constants.AdapterConstants;
|
||||
|
@ -15,6 +30,7 @@ import org.keycloak.representations.adapters.action.GlobalRequestResult;
|
|||
import org.keycloak.representations.adapters.action.LogoutAction;
|
||||
import org.keycloak.representations.adapters.action.PushNotBeforeAction;
|
||||
import org.keycloak.representations.adapters.action.TestAvailabilityAction;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.services.util.ResolveRelative;
|
||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
|
@ -37,7 +53,7 @@ import java.util.Set;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class ResourceAdminManager {
|
||||
protected static Logger logger = Logger.getLogger(ResourceAdminManager.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
private static final String CLIENT_SESSION_HOST_PROPERTY = "${application.session.host}";
|
||||
|
||||
private KeycloakSession session;
|
||||
|
@ -237,7 +253,7 @@ public class ResourceAdminManager {
|
|||
logger.debugf("logout success for %s: %s", managementUrl, success);
|
||||
return success;
|
||||
} catch (IOException e) {
|
||||
logger.warn("Logout for client '" + resource.getClientId() + "' failed", e);
|
||||
logger.logoutFailed(e, resource.getClientId());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +304,7 @@ public class ResourceAdminManager {
|
|||
logger.debugf("pushRevocation success for %s: %s", managementUrl, success);
|
||||
return success;
|
||||
} catch (IOException e) {
|
||||
logger.warn("Failed to send revocation request", e);
|
||||
logger.failedToSendRevocation(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +342,7 @@ public class ResourceAdminManager {
|
|||
logger.debugf("testAvailability success for %s: %s", managementUrl, success);
|
||||
return success;
|
||||
} catch (IOException e) {
|
||||
logger.warn("Availability test failed for uri '" + managementUrl + "'", e);
|
||||
logger.availabilityTestFailed(managementUrl);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
@ -5,7 +21,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.util.Time;
|
||||
import org.keycloak.models.ClientModel;
|
||||
import org.keycloak.models.ClientSessionModel;
|
||||
import org.keycloak.models.Constants;
|
||||
|
@ -16,7 +32,8 @@ import org.keycloak.models.RoleModel;
|
|||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.models.UserSessionModel;
|
||||
import org.keycloak.models.session.UserSessionPersisterProvider;
|
||||
import org.keycloak.common.util.Time;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -24,7 +41,7 @@ import org.keycloak.common.util.Time;
|
|||
*/
|
||||
public class UserSessionManager {
|
||||
|
||||
protected static Logger logger = Logger.getLogger(UserSessionManager.class);
|
||||
protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
private final KeycloakSession kcSession;
|
||||
private final UserSessionPersisterProvider persister;
|
||||
|
@ -119,7 +136,7 @@ public class UserSessionManager {
|
|||
public boolean isOfflineTokenAllowed(ClientSessionModel clientSession) {
|
||||
RoleModel offlineAccessRole = clientSession.getRealm().getRole(Constants.OFFLINE_ACCESS_ROLE);
|
||||
if (offlineAccessRole == null) {
|
||||
logger.warnf("Role '%s' not available in realm", Constants.OFFLINE_ACCESS_ROLE);
|
||||
logger.roleNotInRealm(Constants.OFFLINE_ACCESS_ROLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.util.Time;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.KeycloakSessionFactory;
|
||||
import org.keycloak.models.KeycloakSessionTask;
|
||||
|
@ -10,8 +26,9 @@ import org.keycloak.models.UserFederationProviderFactory;
|
|||
import org.keycloak.models.UserFederationProviderModel;
|
||||
import org.keycloak.models.UserFederationSyncResult;
|
||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
import org.keycloak.timer.TimerProvider;
|
||||
import org.keycloak.common.util.Time;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,7 +37,7 @@ import java.util.List;
|
|||
*/
|
||||
public class UsersSyncManager {
|
||||
|
||||
protected static final Logger logger = Logger.getLogger(UsersSyncManager.class);
|
||||
protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
/**
|
||||
* Check federationProviderModel of all realms and possibly start periodic sync for them
|
||||
|
@ -69,7 +86,7 @@ public class UsersSyncManager {
|
|||
try {
|
||||
syncAllUsers(sessionFactory, realmId, fedProvider);
|
||||
} catch (Throwable t) {
|
||||
logger.error("Error occurred during full sync of users", t);
|
||||
logger.errorDuringFullUserSync(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +104,7 @@ public class UsersSyncManager {
|
|||
try {
|
||||
syncChangedUsers(sessionFactory, realmId, fedProvider);
|
||||
} catch (Throwable t) {
|
||||
logger.error("Error occurred during sync of changed users", t);
|
||||
logger.errorDuringChangedUserSync(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue