Fix parsing of broker user ID if it contains a dot (#32699)

Closes #32698

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
Alexander Schwartz 2024-09-06 14:09:44 +02:00 committed by GitHub
parent ca951c3002
commit 9454c01d88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -367,11 +367,11 @@ public class InfinispanUserSessionProvider implements UserSessionProvider, Sessi
}
if (predicate.getBrokerUserId() != null) {
String[] idpAliasSessionId = predicate.getBrokerUserId().split("\\.");
int split = predicate.getBrokerUserId().indexOf('.');
Map<String, String> attributes = new HashMap<>();
attributes.put(UserModel.IDP_ALIAS, idpAliasSessionId[0]);
attributes.put(UserModel.IDP_USER_ID, idpAliasSessionId[1]);
attributes.put(UserModel.IDP_ALIAS, predicate.getBrokerUserId().substring(0, split));
attributes.put(UserModel.IDP_USER_ID, predicate.getBrokerUserId().substring(split + 1));
UserProvider userProvider = session.getProvider(UserProvider.class);
UserModel userModel = userProvider.searchForUserStream(realm, attributes, 0, null).findFirst().orElse(null);

View file

@ -326,11 +326,11 @@ public class PersistentUserSessionProvider implements UserSessionProvider, Sessi
}
if (predicate.getBrokerUserId() != null) {
String[] idpAliasSessionId = predicate.getBrokerUserId().split("\\.");
int split = predicate.getBrokerUserId().indexOf('.');
Map<String, String> attributes = new HashMap<>();
attributes.put(UserModel.IDP_ALIAS, idpAliasSessionId[0]);
attributes.put(UserModel.IDP_USER_ID, idpAliasSessionId[1]);
attributes.put(UserModel.IDP_ALIAS, predicate.getBrokerUserId().substring(0, split));
attributes.put(UserModel.IDP_USER_ID, predicate.getBrokerUserId().substring(split + 1));
UserProvider userProvider = session.getProvider(UserProvider.class);
UserModel userModel = userProvider.searchForUserStream(realm, attributes, 0, null).findFirst().orElse(null);