Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1cebc9

Browse files
Update README.md
1 parent 05af6c2 commit f1cebc9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,39 @@ HttpSession session = request.getSession();
5353
session.invalidate();
5454
response.sendRedirect("login.jsp");
5555
```
56+
57+
58+
# Spring Boot
59+
60+
* [Adding security headers](#Secure-headers)
61+
62+
63+
## Secure-headers
64+
65+
To implement security headers in application created in spring boot framework we have to add spring security dependencies in pom.xml
66+
67+
```
68+
<dependency>
69+
<groupId>org.springframework.boot</groupId>
70+
<artifactId>spring-boot-starter-security</artifactId>
71+
</dependency>
72+
``
73+
74+
```
75+
Next, create a class that extends the WebSecurityConfigureAdapter. Add the annotation @EnableWebSecurity to the class to tell spring that this class is a spring security configuration.
76+
77+
Override the two overloaded methods configure(HttpSecurity) and configure(AuthenticationManagerBuilder).
78+
79+
The configure(HttpSecurity) defines the mapping of secured URLs or paths that will determine if the user can access specific pages.
80+
81+
82+
@EnableWebSecurity
83+
public class Security extends WebSecurityConfigurerAdapter {
84+
85+
@Override
86+
protected void configure(HttpSecurity http) throws Exception {
87+
88+
}
89+
}
90+
91+
```

0 commit comments

Comments
 (0)