Skip to content

Commit

Permalink
dcm4che-audit-keycloak: support Keycloak.X 22.0.1 fix #1339
Browse files Browse the repository at this point in the history
  • Loading branch information
gunterze committed Aug 17, 2023
1 parent 6c89b36 commit f68226d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.UserModel;

import java.util.Collections;
import java.util.Optional;

/**
Expand Down Expand Up @@ -97,8 +98,8 @@ private static ActiveParticipant user(AdminEvent adminEvent, KeycloakSession ses

private static String username(AdminEvent adminEvent, KeycloakSession session) {
Optional<UserModel> userModel = session.users()
.getUsersStream(session.getContext().getRealm(), false)
.findFirst();
.searchForUserStream(session.getContext().getRealm(), Collections.EMPTY_MAP)
.findFirst();
return userModel.isPresent()
? userModel.get().getUsername()
: adminEvent.getAuthDetails().getUserId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.UserModel;

import java.util.Collections;
import java.util.Optional;


Expand All @@ -60,8 +61,8 @@ class AuditAuth {

static void audit(Event event, AuditLogger auditLogger, KeycloakSession session, String suRole) {
Optional<UserModel> userModel = session.users()
.getUsersStream(session.getContext().getRealm(), false)
.findFirst();
.searchForUserStream(session.getContext().getRealm(), Collections.EMPTY_MAP)
.findFirst();
String username = userModel.isPresent()
? userModel.get().getUsername()
: event.getDetails() == null
Expand Down

0 comments on commit f68226d

Please sign in to comment.