org.springframework.security.core.userdetails.MapReactiveUserDetailsService Java Examples

The following examples show how to use org.springframework.security.core.userdetails.MapReactiveUserDetailsService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RSocketSecurityConfig.java    From spring-rsocket-demo with GNU General Public License v3.0 6 votes vote down vote up
@Bean
MapReactiveUserDetailsService authentication() {
    //This is NOT intended for production use (it is intended for getting started experience only)
    UserDetails user = User.withDefaultPasswordEncoder()
            .username("user")
            .password("pass")
            .roles("USER")
            .build();

    UserDetails admin = User.withDefaultPasswordEncoder()
            .username("test")
            .password("pass")
            .roles("NONE")
            .build();

    return new MapReactiveUserDetailsService(user, admin);
}
 
Example #2
Source File: WebFluxSecurityConfig.java    From tutorials with MIT License 6 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails admin = User
            .withUsername("admin")
            .password(encoder().encode("password"))
            .roles("ADMIN")
            .build();

    UserDetails user = User
            .withUsername("user")
            .password(encoder().encode("password"))
            .roles("USER")
            .build();

    return new MapReactiveUserDetailsService(admin, user);
}
 
Example #3
Source File: SecurityConfig.java    From tutorials with MIT License 6 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails user = User
        .withUsername("user")
        .password(passwordEncoder().encode("password"))
        .roles("USER")
        .build();

    UserDetails admin = User
        .withUsername("admin")
        .password(passwordEncoder().encode("password"))
        .roles("ADMIN")
        .build();

    return new MapReactiveUserDetailsService(user, admin);
}
 
Example #4
Source File: SecurityReactiveApplication.java    From Spring5Tutorial with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Bean
public ReactiveUserDetailsService userDetailsService(PasswordEncoder passwordEncoder) {
    UserDetails admin = User
	      .withUsername("admin")
	      .password(passwordEncoder.encode("admin12345678"))
	      .roles("ADMIN", "MEMBER")
	      .build();

    UserDetails caterpillar = User
	      .withUsername("caterpillar")
	      .password(passwordEncoder.encode("12345678"))
	      .roles("MEMBER")
	      .build();
    
    return new MapReactiveUserDetailsService(admin, caterpillar);
}
 
Example #5
Source File: SecurityConfiguration.java    From Hands-On-Reactive-Programming-in-Spring-5 with MIT License 6 votes vote down vote up
@Bean
public MapReactiveUserDetailsService reactiveUserDetailsService(
    ObjectProvider<PasswordEncoder> passwordEncoder
) {

    return new MapReactiveUserDetailsService(
        User.withUsername("user")
            .password("user")
            .passwordEncoder(p -> getOrDeducePassword(p, passwordEncoder.getIfAvailable()))
            .roles("USER")
            .build(),
        User.withUsername("admin")
            .password("admin")
            .passwordEncoder(p -> getOrDeducePassword(p, passwordEncoder.getIfAvailable()))
            .roles("USER", "ADMIN")
            .build()
    );
}
 
Example #6
Source File: SpringSecurityWebReactiveEndpointsBootstrap.java    From thinking-in-spring-boot-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails user = User.withDefaultPasswordEncoder()
            .username("mercyblitz")
            .password("123456")
            .roles("ENDPOINT_ADMIN")
            .build();
    return new MapReactiveUserDetailsService(user);
}
 
Example #7
Source File: SecurityConfig.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
    PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
    UserDetails user = User.withUsername("user")
            .passwordEncoder(encoder::encode)
            .password("password")
            .roles("USER")
            .build();
    UserDetails admin = User.withUsername("admin")
            .passwordEncoder(encoder::encode)
            .password("password")
            .roles("USER", "ADMIN")
            .build();
    return new MapReactiveUserDetailsService(user, admin);
}
 
Example #8
Source File: SecurityConfig.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
    UserBuilder users = User.withDefaultPasswordEncoder();
    UserDetails user = users.username("user").password("password").roles("USER").build();
    UserDetails admin = users.username("admin").password("password").roles("USER", "ADMIN").build();
    return new MapReactiveUserDetailsService(user, admin);
}
 
Example #9
Source File: SecurityConfig.java    From spring-5-examples with MIT License 5 votes vote down vote up
@Bean MapReactiveUserDetailsService userDetailsService() {
  return new MapReactiveUserDetailsService(
      User.withUsername("max")
          .password("max")
          .roles("USER")
          .build()
  );
}
 
Example #10
Source File: SecurityConfig.java    From aws-serverless-java-container with Apache License 2.0 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails user = User
            .withUsername(USERNAME)
            .password(passwordEncoder.encode(PASSWORD))
            .roles("USER")
            .build();
    return new MapReactiveUserDetailsService(user);
}
 
Example #11
Source File: ReservationClientApplication.java    From bootiful-reactive-microservices with Apache License 2.0 5 votes vote down vote up
@Bean
MapReactiveUserDetailsService authentication() {

	UserDetails jlong = User.withDefaultPasswordEncoder()
		.password("pw").username("jlong").roles("USER").build();

	UserDetails rwinch = User.withDefaultPasswordEncoder()
		.password("pw").username("rwinch").roles("USER", "ADMIN").build();

	return new MapReactiveUserDetailsService(jlong, rwinch);
}
 
Example #12
Source File: SecurityConfig.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails user = User.builder().
            username(Objects.requireNonNull(env.getProperty("anonymousUser"))).
            password("{noop}" + env.getProperty("anonymousKey")).
            roles(IdRepoEntitlement.ANONYMOUS).
            build();
    return new MapReactiveUserDetailsService(user);
}
 
Example #13
Source File: ReservationClientApplication.java    From bootiful-reactive-microservices with Apache License 2.0 5 votes vote down vote up
@Bean
MapReactiveUserDetailsService authentication() {
	User.UserBuilder builder = User.withDefaultPasswordEncoder();
	return new MapReactiveUserDetailsService(
		builder.username("jlong").password("pw").roles("USER").build(),
		builder.username("rwinch").password("pw").roles("USER", "ADMIN").build()
	);
}
 
Example #14
Source File: SecurityConfiguration.java    From vertx-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails user = User.withDefaultPasswordEncoder()
        .username("user")
        .password("user")
        .roles("USER")
        .build();

    return new MapReactiveUserDetailsService(user);
}
 
Example #15
Source File: EmployeeWebSecurityConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails user = User
        .withUsername("admin")
        .password(passwordEncoder().encode("password"))
        .roles("ADMIN")
        .build();
    return new MapReactiveUserDetailsService(user);
}
 
Example #16
Source File: HttpIT.java    From vertx-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
    UserDetails user = User.withDefaultPasswordEncoder()
        .username("user")
        .password("password")
        .roles("USER")
        .build();
    return new MapReactiveUserDetailsService(user);
}
 
Example #17
Source File: GatewayApplication.java    From Spring5Tutorial with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
public ReactiveUserDetailsService userDetailsService(PasswordEncoder passwordEncoder) {
    UserDetails webclient = User
          .withUsername(clientName)
          .password(passwordEncoder.encode(clientSecret))
          .roles("account", "message", "email")
          .build();

    return new MapReactiveUserDetailsService(webclient);
}
 
Example #18
Source File: ReactiveSecurityApplication.java    From training with Apache License 2.0 5 votes vote down vote up
@Bean
ReactiveUserDetailsService authentication() {
	return new MapReactiveUserDetailsService(
			User.withDefaultPasswordEncoder()
					.roles("USER")
					.username("user")
					.password("password")
					.build());
}
 
Example #19
Source File: ReservationClientApplication.java    From training with Apache License 2.0 5 votes vote down vote up
@Bean
ReactiveUserDetailsService authentication() {
	return new MapReactiveUserDetailsService(
			User.withDefaultPasswordEncoder()
					.username("user")
					.password("password")
					.roles("USER")
					.build()
	);
}
 
Example #20
Source File: ReactiveSecurityApplication.java    From training with Apache License 2.0 5 votes vote down vote up
@Bean
ReactiveUserDetailsService authentication() {
	return new MapReactiveUserDetailsService(
			User.withDefaultPasswordEncoder()
					.roles("USER")
					.username("user")
					.password("password")
					.build());
}
 
Example #21
Source File: ReservationClientApplication.java    From training with Apache License 2.0 5 votes vote down vote up
@Bean
ReactiveUserDetailsService authentication() {
		return new MapReactiveUserDetailsService(
			User.withDefaultPasswordEncoder()
				.username("user")
				.password("password")
				.roles("USER")
				.build()
		);
}
 
Example #22
Source File: SecurityConfiguration.java    From Hands-On-Reactive-Programming-in-Spring-5 with MIT License 5 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsService() {
	UserDetails userAdmin = User.withDefaultPasswordEncoder()
	                            .username("admin")
	                            .password("admin")
	                            .roles("ADMIN")
	                            .build();
	UserDetails userUser = User.withDefaultPasswordEncoder()
	                            .username("user")
	                            .password("user")
	                            .roles("USER")
	                            .build();
	return new MapReactiveUserDetailsService(userAdmin, userUser);
}
 
Example #23
Source File: PrincipalNameKeyResolverIntegrationTests.java    From spring-cloud-gateway with Apache License 2.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService reactiveUserDetailsService() {
	UserDetails user = User.withUsername("user").password("{noop}password")
			.roles("USER").build();
	return new MapReactiveUserDetailsService(user);
}
 
Example #24
Source File: DemoApplication.java    From spring-reactive-sample with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
    UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("USER").build();
    UserDetails admin = User.withDefaultPasswordEncoder().username("admin").password("password").roles("USER", "ADMIN").build();
    return new MapReactiveUserDetailsService(user, admin);
}
 
Example #25
Source File: SecurityConfig.java    From spring-reactive-sample with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
	UserDetails rob = User.withDefaultPasswordEncoder().username("test").password("password").roles("USER").build();
	UserDetails admin = User.withDefaultPasswordEncoder().username("admin").password("password").roles("USER","ADMIN").build();
	return new MapReactiveUserDetailsService(rob, admin);
}
 
Example #26
Source File: Application.java    From spring-cloud-study with Apache License 2.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService reactiveUserDetailsService() {
    UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("USER").build();
    return new MapReactiveUserDetailsService(user);
}
 
Example #27
Source File: SecurityConfig.java    From spring-reactive-sample with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
	UserDetails rob = User.withDefaultPasswordEncoder().username("test").password("password").roles("USER").build();
	UserDetails admin = User.withDefaultPasswordEncoder().username("admin").password("password").roles("USER","ADMIN").build();
	return new MapReactiveUserDetailsService(rob, admin);
}
 
Example #28
Source File: DemoApplication.java    From spring-reactive-sample with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
    UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("USER").build();
    UserDetails admin = User.withDefaultPasswordEncoder().username("admin").password("password").roles("USER", "ADMIN").build();
    return new MapReactiveUserDetailsService(user, admin);
}
 
Example #29
Source File: DemoApplication.java    From spring-reactive-sample with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
	UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("USER").build();
	UserDetails admin = User.withDefaultPasswordEncoder().username("admin").password("password").roles("USER","ADMIN").build();
	return new MapReactiveUserDetailsService(user, admin);
}
 
Example #30
Source File: SecurityConfig.java    From spring-reactive-sample with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public MapReactiveUserDetailsService userDetailsRepository() {
    UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("USER").build();
    UserDetails admin = User.withDefaultPasswordEncoder().username("admin").password("password").roles("USER", "ADMIN").build();
    return new MapReactiveUserDetailsService(user, admin);
}