Commit 0746c6b7 by Johannes Edmeier

Add profile to sample for disabling security

parent 7602ce3a
...@@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; ...@@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
...@@ -40,6 +41,7 @@ public class SpringBootAdminApplication { ...@@ -40,6 +41,7 @@ public class SpringBootAdminApplication {
SpringApplication.run(SpringBootAdminApplication.class, args); SpringApplication.run(SpringBootAdminApplication.class, args);
} }
@Profile("secure")
// tag::configuration-spring-security[] // tag::configuration-spring-security[]
@Configuration @Configuration
public static class SecurityConfig extends WebSecurityConfigurerAdapter { public static class SecurityConfig extends WebSecurityConfigurerAdapter {
......
---
info: info:
scm-url: "@scm.url@" scm-url: "@scm.url@"
build-url: "http://travis-ci.org/@env.TRAVIS_REPO_SLUG@/builds/@env.TRAVIS_BUILD_ID@" build-url: "http://travis-ci.org/@env.TRAVIS_REPO_SLUG@/builds/@env.TRAVIS_BUILD_ID@"
...@@ -15,6 +16,27 @@ spring: ...@@ -15,6 +16,27 @@ spring:
boot: boot:
admin: admin:
url: http://localhost:8080 url: http://localhost:8080
profiles:
active:
- secure
---
spring:
profiles: insecure
management:
security:
enabled: false
security:
basic:
enabled: false
---
spring:
profiles: secure
boot:
admin:
username: "${security.user.name}" #These two are needed so that the client username: "${security.user.name}" #These two are needed so that the client
password: "${security.user.password}" #can register at the protected server api password: "${security.user.password}" #can register at the protected server api
client: client:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment