Codota Logo
MapReactiveUserDetailsService
Code IndexAdd Codota to your IDE (free)

How to use
MapReactiveUserDetailsService
in
org.springframework.security.core.userdetails

Best Java code snippets using org.springframework.security.core.userdetails.MapReactiveUserDetailsService (Showing top 20 results out of 315)

  • Common ways to obtain MapReactiveUserDetailsService
private void myMethod () {
MapReactiveUserDetailsService m =
  • Codota IconUserDetails[] users;new MapReactiveUserDetailsService(users)
  • Codota IconCollection users;new MapReactiveUserDetailsService(users)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-security

@Override
public MapReactiveUserDetailsService getObject() throws Exception {
  Collection<UserDetails> users = userDetails.getObject();
  return new MapReactiveUserDetailsService(users);
}
origin: spring-projects/spring-security

/**
 * Creates a new instance
 * @param users the {@link UserDetails} to use
 */
public MapReactiveUserDetailsService(Collection<UserDetails> users) {
  Assert.notEmpty(users, "users cannot be null or empty");
  this.users = users.stream().collect(Collectors.toConcurrentMap( u -> getKey(u.getUsername()), Function.identity()));
}
origin: spring-projects/spring-security

  @Test
  public void updatePassword() {
    users.updatePassword(USER_DETAILS, "new").block();
    assertThat(users.findByUsername(USER_DETAILS.getUsername()).block().getPassword()).isEqualTo("new");
  }
}
origin: spring-projects/spring-security

@Test
public void findByUsernameWhenNotFoundThenEmpty() {
  assertThat((users.findByUsername("notfound"))).isEqualTo(Mono.empty());
}
origin: spring-projects/spring-security

@Test
public void findByUsernameWhenDifferentCaseThenReturns() {
  assertThat((users.findByUsername("uSeR").block())).isEqualTo(USER_DETAILS);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorNullUsers() {
  Collection<UserDetails> users = null;
  new MapReactiveUserDetailsService(users);
}
origin: spring-projects/spring-security

@Override
public Mono<UserDetails> findByUsername(String username) {
  String key = getKey(username);
  UserDetails result = users.get(key);
  return result == null ? Mono.empty() : Mono.just(User.withUserDetails(result).build());
}
origin: spring-projects/spring-security

@Test
public void findByUsernameWhenFoundThenReturns() {
  assertThat((users.findByUsername(USER_DETAILS.getUsername()).block())).isEqualTo(USER_DETAILS);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorEmptyUsers() {
  Collection<UserDetails> users = Collections.emptyList();
  new MapReactiveUserDetailsService(users);
}
origin: org.springframework.security/spring-security-core

@Override
public Mono<UserDetails> findByUsername(String username) {
  String key = getKey(username);
  UserDetails result = users.get(key);
  return result == null ? Mono.empty() : Mono.just(User.withUserDetails(result).build());
}
origin: spring-projects/spring-security

@Test
public void findByUsernameWhenClearCredentialsThenFindByUsernameStillHasCredentials() {
  User foundUser = users.findByUsername(USER_DETAILS.getUsername()).cast(User.class).block();
  assertThat(foundUser.getPassword()).isNotEmpty();
  foundUser.eraseCredentials();
  assertThat(foundUser.getPassword()).isNull();
  foundUser = users.findByUsername(USER_DETAILS.getUsername()).cast(User.class).block();
  assertThat(foundUser.getPassword()).isNotEmpty();
}
origin: spring-projects/spring-security

  @Bean
  public static ReactiveUserDetailsService userDetailsService() {
    return new MapReactiveUserDetailsService(PasswordEncodedUser.user(), PasswordEncodedUser.admin());
  }
}
origin: org.springframework.security/spring-security-core

/**
 * Creates a new instance
 * @param users the {@link UserDetails} to use
 */
public MapReactiveUserDetailsService(Collection<UserDetails> users) {
  Assert.notEmpty(users, "users cannot be null or empty");
  this.users = users.stream().collect(Collectors.toConcurrentMap( u -> getKey(u.getUsername()), Function.identity()));
}
origin: spring-projects/spring-security

  @Bean
  public MapReactiveUserDetailsService userDetailsService() {
    return new MapReactiveUserDetailsService(User.withUsername("user")
        .password("{noop}password")
        .roles("USER")
        .build()
    );
  }
}
origin: spring-projects/spring-security

@Override
public Mono<UserDetails> updatePassword(UserDetails user, String newPassword) {
  return Mono.just(user)
      .map(u ->
        User.withUserDetails(u)
          .password(newPassword)
          .build()
      )
      .doOnNext(u -> {
        String key = getKey(user.getUsername());
        this.users.put(key, u);
      });
}
origin: spring-cloud/spring-cloud-gateway

@Bean
public MapReactiveUserDetailsService reactiveUserDetailsService() {
  UserDetails user = User.withUsername("user").password("{noop}password").roles("USER").build();
  return new MapReactiveUserDetailsService(user);
}
origin: org.springframework.security/spring-security-core

@Override
public Mono<UserDetails> updatePassword(UserDetails user, String newPassword) {
  return Mono.just(user)
      .map(u ->
        User.withUserDetails(u)
          .password(newPassword)
          .build()
      )
      .doOnNext(u -> {
        String key = getKey(user.getUsername());
        this.users.put(key, u);
      });
}
origin: spring-projects/spring-security

@Bean
public ReactiveUserDetailsService userDetailsService(PasswordEncoder encoder) {
  return new MapReactiveUserDetailsService(User.withUsername("user")
    .password(encoder.encode("password"))
    .roles("USER")
    .build()
  );
}
origin: apache/servicemix-bundles

/**
 * Creates a new instance
 * @param users the {@link UserDetails} to use
 */
public MapReactiveUserDetailsService(Collection<UserDetails> users) {
  Assert.notEmpty(users, "users cannot be null or empty");
  this.users = users.stream().collect(Collectors.toConcurrentMap( u -> getKey(u.getUsername()), Function.identity()));
}
origin: org.springframework.security/spring-security-config

@Override
public MapReactiveUserDetailsService getObject() throws Exception {
  Collection<UserDetails> users = userDetails.getObject();
  return new MapReactiveUserDetailsService(users);
}
org.springframework.security.core.userdetailsMapReactiveUserDetailsService

Javadoc

A Map based implementation of ReactiveUserDetailsService

Most used methods

  • <init>
    Creates a new instance
  • getKey
  • findByUsername
  • updatePassword

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • getExternalFilesDir (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JPanel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now