File tree Expand file tree Collapse file tree 17 files changed +41
-26
lines changed
java/com/greglturnquist/learningspringboot
java/com/greglturnquist/learningspringboot Expand file tree Collapse file tree 17 files changed +41
-26
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ dependencies {
7676 compile(' org.springframework.security:spring-security-config' )
7777 compile(' org.springframework.security:spring-security-webflux' )
7878
79+ compile(' org.springframework.boot:spring-boot-starter-data-mongodb-reactive' )
80+
7981 compile(' org.springframework.session:spring-session-data-mongodb:2.0.0.M3' )
8082
8183 // tag::zuul[]
Original file line number Diff line number Diff line change 11buildscript {
22 ext {
33 springBootVersion = ' 2.0.0.M4'
4- springCloudVersion = ' Finchley.BUILD-SNAPSHOT '
4+ springCloudVersion = ' Finchley.M2 '
55 springCloudStreamVersion = ' Elmhurst.M1'
66 }
77 repositories {
Original file line number Diff line number Diff line change 11buildscript {
22 ext {
33 springBootVersion = ' 2.0.0.M4'
4- springCloudVersion = ' Finchley.BUILD-SNAPSHOT '
4+ springCloudVersion = ' Finchley.M2 '
55 }
66 repositories {
77 mavenCentral()
Original file line number Diff line number Diff line change 1818import org .springframework .boot .SpringApplication ;
1919import org .springframework .boot .autoconfigure .SpringBootApplication ;
2020import org .springframework .cloud .config .server .EnableConfigServer ;
21+ import org .springframework .context .annotation .Bean ;
22+ import org .springframework .security .core .userdetails .User ;
23+ import org .springframework .security .core .userdetails .UserDetailsService ;
24+ import org .springframework .security .provisioning .InMemoryUserDetailsManager ;
2125
2226/**
2327 * @author Greg Turnquist
@@ -31,5 +35,13 @@ public static void main(String[] args) {
3135 SpringApplication .run (
3236 LearningSpringBootConfigServer .class , args );
3337 }
38+
39+ @ Bean
40+ public UserDetailsService userDetailsService () throws Exception {
41+ InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager ();
42+ manager .createUser (User .withUsername ("user" ).password ("password" )
43+ .roles ("USER" ).build ());
44+ return manager ;
45+ }
3446}
3547// end::code[]
Original file line number Diff line number Diff line change 77 server :
88 git :
99 uri : https://github.com/gregturn/learning-spring-boot-config-repo
10-
11- # tag::secured[]
12- security :
13- user :
14- password : password
15- # tag::secured[]
Original file line number Diff line number Diff line change 11buildscript {
22 ext {
3- springBootVersion = ' 2.0.0.M4 '
4- springCloudVersion = ' Finchley.BUILD-SNAPSHOT '
3+ springBootVersion = ' 2.0.0.M3 '
4+ springCloudVersion = ' Finchley.M2 '
55 }
66 repositories {
77 mavenCentral()
3939}
4040
4141dependencies {
42- compile(' org.springframework.cloud:spring-cloud-starter-eureka-server' )
42+ compile(' org.springframework.boot:spring-boot-starter-web' )
43+ compile(' org.springframework.cloud:spring-cloud-starter-netflix-eureka-server' )
4344
4445 // tag::code[]
4546 compile(' org.springframework.cloud:spring-cloud-starter-config' )
Original file line number Diff line number Diff line change 1818import org .springframework .boot .SpringApplication ;
1919import org .springframework .boot .autoconfigure .SpringBootApplication ;
2020import org .springframework .cloud .netflix .eureka .server .EnableEurekaServer ;
21+ import org .springframework .context .annotation .Bean ;
22+ import org .springframework .security .core .userdetails .User ;
23+ import org .springframework .security .core .userdetails .UserDetailsService ;
24+ import org .springframework .security .provisioning .InMemoryUserDetailsManager ;
2125
2226/**
2327 * @author Greg Turnquist
@@ -31,5 +35,13 @@ public static void main(String[] args) {
3135 SpringApplication .run (
3236 LearningSpringBootEurekaServerApplication .class );
3337 }
38+
39+ @ Bean
40+ public UserDetailsService userDetailsService () throws Exception {
41+ InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager ();
42+ manager .createUser (User .withUsername ("user" ).password ("password" )
43+ .roles ("USER" ).build ());
44+ return manager ;
45+ }
3446}
3547// end::code[]
Original file line number Diff line number Diff line change 77 label : session
88 password : password
99# end::secured-config-server[]
10-
11- # tag::secured[]
12- security :
13- user :
14- password : password
15- # tag::secured[]
Original file line number Diff line number Diff line change 11buildscript {
22 ext {
33 springBootVersion = ' 2.0.0.M4'
4- springCloudVersion = ' Finchley.BUILD-SNAPSHOT '
4+ springCloudVersion = ' Finchley.M2 '
55 }
66 repositories {
77 mavenCentral()
Original file line number Diff line number Diff line change 11buildscript {
22 ext {
33 springBootVersion = ' 2.0.0.M4'
4- springCloudVersion = ' Finchley.BUILD-SNAPSHOT '
4+ springCloudVersion = ' Finchley.M2 '
55 springCloudStreamVersion = ' Elmhurst.M1'
66 }
77 repositories {
You can’t perform that action at this time.
0 commit comments