Changes to align to new API of Keycloak v15.1.1
This commit is contained in:
parent
3ac6b09a1c
commit
6ef80e59ef
|
@ -35,8 +35,8 @@ public abstract class AbstractAvatarResource {
|
|||
|
||||
private AuthResult authenticate(KeycloakSession session) {
|
||||
logger.debug("Authenticating with bearer token");
|
||||
AuthResult auth = new AppAuthManager().authenticateBearerToken(session, session.getContext().getRealm());
|
||||
|
||||
AuthResult auth = this.auth = new AppAuthManager.BearerTokenAuthenticator(session).authenticate();
|
||||
|
||||
if (auth == null) {
|
||||
logger.debug("Authenticating with identity cookie");
|
||||
auth = new AppAuthManager().authenticateIdentityCookie(session, session.getContext().getRealm());
|
||||
|
|
|
@ -48,7 +48,7 @@ public class AvatarAdminResource extends AbstractAvatarResource {
|
|||
@Produces({ "image/png", "image/jpeg", "image/gif" })
|
||||
public Response downloadUserAvatarImage(@PathParam("user_id") String userId) {
|
||||
try {
|
||||
UserModel user = session.users().getUserById(userId, session.getContext().getRealm());
|
||||
UserModel user = session.users().getUserById(session.getContext().getRealm(), userId);
|
||||
return fetchAndCreateResponse(session.getContext().getRealm(), user);
|
||||
} catch (ForbiddenException e) {
|
||||
return Response.status(Response.Status.FORBIDDEN).entity(e.getMessage()).build();
|
||||
|
@ -69,7 +69,7 @@ public class AvatarAdminResource extends AbstractAvatarResource {
|
|||
}
|
||||
|
||||
RealmModel realm = session.getContext().getRealm();
|
||||
UserModel user = session.users().getUserById(userId, session.getContext().getRealm());
|
||||
UserModel user = session.users().getUserById(session.getContext().getRealm(), userId);
|
||||
|
||||
InputStream imageInputStream = input.getFormDataPart(AVATAR_IMAGE_PARAMETER, InputStream.class, null);
|
||||
saveUserImage(realm, user, imageInputStream);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class OrchestratorEventPublisherProvider extends AbstractEventPublisher
|
|||
@Override
|
||||
public void onEvent(Event event) {
|
||||
if (!INTERESTING_EVENTS.contains(event.getType())) {
|
||||
logger.debug("Skipping publish of not interesting event");
|
||||
logger.tracef("Skipping publish of not interesting event: %s", event.getType().toString());
|
||||
return;
|
||||
}
|
||||
logger.debug("Publishing new event to orchestrator");
|
||||
|
|
|
@ -55,8 +55,7 @@ public class OrchestratorEventPublisherProviderFactory implements EventListenerP
|
|||
try {
|
||||
newOrchestratorEndpoint = new URL(orchestratorClient.getBaseUrl());
|
||||
} catch (MalformedURLException e) {
|
||||
logger.errorf("Can't create new orchestrator endpoint address: %s", orchestratorClient.getBaseUrl(),
|
||||
e);
|
||||
logger.errorf("Can't create new orchestrator endpoint address: %s", orchestratorClient.getBaseUrl());
|
||||
oepp = new NoOpEventPublisherProvider();
|
||||
return oepp;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ public class UserAttributeTemplatedLDAPStorageMapper extends AbstractLDAPStorage
|
|||
} else {
|
||||
|
||||
// we don't have java property. Let's set attribute
|
||||
List<String> attrValues = localUser.getAttribute(userModelAttrName);
|
||||
List<String> attrValues = localUser.getAttributeStream(userModelAttrName).collect(Collectors.toList());
|
||||
|
||||
if (attrValues.size() == 0) {
|
||||
if (isMandatoryInLdap) {
|
||||
|
@ -171,7 +171,7 @@ public class UserAttributeTemplatedLDAPStorageMapper extends AbstractLDAPStorage
|
|||
// lowercase before search
|
||||
email = KeycloakModelUtils.toLowerCaseSafe(email);
|
||||
|
||||
UserModel that = session.userLocalStorage().getUserByEmail(email, realm);
|
||||
UserModel that = session.userLocalStorage().getUserByEmail(realm, email);
|
||||
if (that != null && !that.getId().equals(user.getId())) {
|
||||
session.getTransactionManager().setRollbackOnly();
|
||||
String exceptionMessage = String.format(
|
||||
|
@ -191,7 +191,7 @@ public class UserAttributeTemplatedLDAPStorageMapper extends AbstractLDAPStorage
|
|||
}
|
||||
boolean usernameChanged = !username.equals(user.getUsername());
|
||||
if (realm.isEditUsernameAllowed() && usernameChanged) {
|
||||
UserModel that = session.users().getUserByUsername(username, realm);
|
||||
UserModel that = session.users().getUserByUsername(realm, username);
|
||||
if (that != null && !that.getId().equals(user.getId())) {
|
||||
throw new ModelDuplicateException(
|
||||
String.format(
|
||||
|
|
Loading…
Reference in New Issue