Spring Boot Spring Security 1
Spring Security
Spring Security
is one of spring component which covers spring
Dependencies
Easiest way, we can use starter.
compile("org.springframework.boot:spring-boot-starter-security")
So far, spring-security-web, sprint-security-config are enough.
compile("org.springframework.security:spring-security-web")
compile("org.springframework.security:spring-security-config")
First Easy Sample
Let’s integrate with simple Spring boot application.
This is from Hello Spring Security Java Config.
SimpleSecurityConfig.java
@EnableWebSecurity
public class SimpleSecurityConfig {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
}
Set this as spring configuration, Spring Security becomes enabled. localhost:8080/login becomes default login page.
And you can try authentication with above setting.
username : “user”, password: “password”.
Good Ref
TERASOLUNA Server Framework for Java (5.x) Development Guideline
