Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue for authenticated by email users who change their email #115

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ public Optional<ExtendedGeorchestraUser> findByUsername(@NonNull String serviceN
return extend(serviceName, user);
}

public Optional<ExtendedGeorchestraUser> findByEmail(@NonNull String serviceName, @NonNull String email) {
UsersApi usersApi = usersByConfigName.get(serviceName);
Objects.requireNonNull(usersApi, () -> "No UsersApi found for config named " + serviceName);
Optional<GeorchestraUser> user = usersApi.findByEmail(email);
return extend(serviceName, user);
}

private Optional<ExtendedGeorchestraUser> extend(String serviceName, Optional<GeorchestraUser> user) {
OrganizationsApi orgsApi = orgsByConfigName.get(serviceName);
Objects.requireNonNull(orgsApi, () -> "No OrganizationsApi found for config named " + serviceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
}
Assert.notNull(password, "Null password was supplied in authentication token");
DirContextOperations userData = doAuthentication(userToken);
UserDetails user = this.userDetailsContextMapper.mapUserFromContext(userData, authentication.getName(),
UserDetails user = this.userDetailsContextMapper.mapUserFromContext(userData, username,
loadUserAuthorities(userData, authentication.getName(), (String) authentication.getCredentials()));

return createSuccessfulAuthentication(userToken, user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ Optional<GeorchestraUser> map(GeorchestraUserNamePasswordAuthenticationToken tok
final String username = principal.getUsername();

Optional<ExtendedGeorchestraUser> user = users.findByUsername(ldapConfigName, username);
if (user.isEmpty()) {
user = users.findByEmail(ldapConfigName, username);
}

return user.map(u -> fixPrefixedRoleNames(u, token));
}

Expand Down
Loading