Skip to content

Commit

Permalink
Fix issue #2917
Browse files Browse the repository at this point in the history
Perform shadow user creation (NewUserAuthenticatedEvent)
without authorities creation, but rely on event
ExternalGroupAuthorizationEvent later.

Includes: IT for testing a fix of issue #2917
  • Loading branch information
strehle committed Jun 7, 2024
1 parent 099174e commit c565156
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public Authentication authenticate(Authentication request) throws Authentication
if (!isAddNewShadowUser()) {
throw new AccountNotPreCreatedException("The user account must be pre-created. Please contact your system administrator.");
}
publish(new NewUserAuthenticatedEvent(userFromRequest));
publish(new NewUserAuthenticatedEvent(userFromRequest.authorities(List.of())));
try {
userFromDb = userDatabase.retrieveUserByName(userFromRequest.getUsername(), getOrigin());
} catch (UsernameNotFoundException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public UaaUser authorities(Collection<? extends GrantedAuthority> authorities) {
if (!values.contains(UaaAuthority.UAA_USER)) {
values.add(UaaAuthority.UAA_USER);
}
return new UaaUser(id, username, getPassword(), email, values, givenName, familyName, created, modified, origin, externalId, verified, zoneId, salt, passwordLastModified);
return new UaaUser(new UaaUserPrototype(this).withAuthorities(values));
}

@Override
Expand Down

0 comments on commit c565156

Please sign in to comment.