Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions java/app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
16 changes: 14 additions & 2 deletions java/app/src/main/java/com/example/demo/DemoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
//Security Imports
import org.springframework.context.annotation.Bean;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;


@SpringBootApplication
@Configuration
public class DemoApplication {

@Value("${NAME:World}")
Expand All @@ -19,9 +26,14 @@ String hello() {
return "Hello " + name + "!";
}
}
//default username and password can be configured from here Username default is user and password temp
@Bean
public InMemoryUserDetailsManager userDetailsManager(){
UserDetails john=org.springframework.security.core.userdetails.User.builder().username("user").password("{noop}temp").roles("Employee").build();
return new InMemoryUserDetailsManager(john);
}

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

}
}