package de.springbootbuch.reactive.filmstore;

import java.util.Optional;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsRepository;
import reactor.core.publisher.Mono;

/**
 * Part of springbootbuch.de.
 * 
 * @author Michael J. Simons
 * @author @rotnroll666
 */
public class UserDetailsRepositoryImpl 
	implements UserDetailsRepository 
{
	@Override
	public Mono<UserDetails> findByUsername(
		String username
	) {
		return Mono.justOrEmpty(
			Optional.ofNullable(
				"tina".equals(username) ? 
					User.withUsername("tina").build() : 
					null)
		);
	}
}

@@ -44,35 +44,8 @@
 e;%0A%0A
-import java.util.Optional;%0A
 impo
@@ -557,33 +557,8 @@
 ty(%0A
-%09%09%09Optional.ofNullable(%0A%09
 %09%09%09%22
@@ -583,17 +583,16 @@
 ame) ? %0A
-%09
 %09%09%09%09User
@@ -632,14 +632,12 @@
 %09%09%09%09
-%09
 null
-)
 %0A%09%09)

Remove unnecessary optional