diff --git a/restful-web-service/pom.xml b/restful-web-service/pom.xml index 271a41a7..e1a3ab89 100644 --- a/restful-web-service/pom.xml +++ b/restful-web-service/pom.xml @@ -39,6 +39,11 @@ org.springframework.boot spring-boot-starter-actuator + + org.springframework.boot + spring-boot-starter-security + 2.4.0 + org.springframework.data spring-data-rest-hal-browser diff --git a/restful-web-service/src/main/java/com/example/restfulwebservice/config/SecurityConfig.java b/restful-web-service/src/main/java/com/example/restfulwebservice/config/SecurityConfig.java new file mode 100644 index 00000000..de108f01 --- /dev/null +++ b/restful-web-service/src/main/java/com/example/restfulwebservice/config/SecurityConfig.java @@ -0,0 +1,18 @@ +package com.example.restfulwebservice.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +public class SecurityConfig extends WebSecurityConfigurerAdapter { + @Autowired + public void ConfigureGlobal(AuthenticationManagerBuilder auth) + throws Exception{ + auth.inMemoryAuthentication() + .withUser("kim") + .password("{noop}test1234") + .roles("USER"); + } +} diff --git a/restful-web-service/src/main/resources/application.yml b/restful-web-service/src/main/resources/application.yml index 26fa09f4..85d7fd4f 100644 --- a/restful-web-service/src/main/resources/application.yml +++ b/restful-web-service/src/main/resources/application.yml @@ -8,9 +8,13 @@ logging: spring: messages: basename: messages + security: + user: + name: username + password: passw0rd management: endpoints: web: exposure: - include: "*" \ No newline at end of file + include: "*"