Make webfinger discovery case insensitive
This commit is contained in:
parent
fe05e2ffa4
commit
15b420b87a
2 changed files with 11 additions and 2 deletions
|
|
@ -50,8 +50,8 @@ public class WebFingerController {
|
|||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
|
||||
// Look up user
|
||||
Optional<User> userOpt = userRepository.findByUsername(username);
|
||||
// Look up user (case-insensitive)
|
||||
Optional<User> userOpt = userRepository.findByUsernameIgnoreCase(username);
|
||||
if (userOpt.isEmpty()) {
|
||||
log.warn("User not found for WebFinger request: {}", username);
|
||||
return ResponseEntity.notFound().build();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,15 @@ public interface UserRepository extends JpaRepository<User, UUID> {
|
|||
*/
|
||||
Optional<User> findByUsername(String username);
|
||||
|
||||
/**
|
||||
* Finds a user by username (case-insensitive).
|
||||
* Used for WebFinger discovery to allow case-insensitive lookups.
|
||||
*
|
||||
* @param username the username
|
||||
* @return optional user
|
||||
*/
|
||||
Optional<User> findByUsernameIgnoreCase(String username);
|
||||
|
||||
/**
|
||||
* Finds a user by email.
|
||||
* Used for login and duplicate email checking.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue