Merge branch 'BAEL-19790' of https://github.com/kwoyke/tutorials into BAEL-19790
This commit is contained in:
commit
6f43b1b69d
|
@ -4,9 +4,8 @@ import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@ -22,7 +21,7 @@ public class ConfigClient {
|
||||||
SpringApplication.run(ConfigClient.class, args);
|
SpringApplication.run(ConfigClient.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/whoami/{username}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
|
@GetMapping(value = "/whoami/{username}", produces = MediaType.TEXT_PLAIN_VALUE)
|
||||||
public String whoami(@PathVariable("username") String username) {
|
public String whoami(@PathVariable("username") String username) {
|
||||||
return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password);
|
return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,14 @@ 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;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SecurityConfigurer extends WebSecurityConfigurerAdapter {
|
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(HttpSecurity http) throws Exception {
|
public void configure(HttpSecurity http) throws Exception {
|
||||||
http.csrf()
|
http.csrf()
|
||||||
.disable()
|
.ignoringAntMatchers("/encrypt/**")
|
||||||
.httpBasic();
|
.ignoringAntMatchers("/decrypt/**");
|
||||||
|
|
||||||
|
super.configure(http);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
server.port=8888
|
server.port=8888
|
||||||
spring.cloud.config.server.git.uri=file:///${user.home}/config-repo
|
spring.cloud.config.server.git.uri=
|
||||||
spring.cloud.config.server.git.clone-on-start=true
|
spring.cloud.config.server.git.clone-on-start=true
|
||||||
spring.security.user.name=root
|
spring.security.user.name=root
|
||||||
spring.security.user.password=s3cr3t
|
spring.security.user.password=s3cr3t
|
||||||
|
|
Loading…
Reference in New Issue