Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4c578aa

Browse files
committedFeb 16, 2023
Thank You for Choosing to Learn from in28Minutes
1 parent c9860b2 commit 4c578aa

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed
 

‎00-02-update-2023-02.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## To Record
2+
3+
- Step 75 - Configure Spring Security to disable CSRF and enable OPTION Requests
4+
- https://www.udemy.com/course/spring-boot-and-spring-framework-tutorial-for-beginners/learn/lecture/35017794#overview
5+
- Add Spring Security Section
6+
7+
18
## Code Changes
29

310
### /frontend/todo/src/app/list-todos/list-todos.component.ts
@@ -104,5 +111,3 @@ export class TodoComponent implements OnInit {
104111
- handleErrorResponse(error) {
105112
+ handleErrorResponse(error: any) {
106113
```
107-
108-

‎99-reuse/01-spring-security-jwt.md renamed to ‎99-reuse/01-spring-security.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,40 @@
2424

2525
## Spring Security - Configuration for Basic Auth
2626

27+
### Spring Boot 2
28+
29+
```
30+
package com.in28minutes.rest.webservices.restfulwebservices.basic.auth;
31+
32+
import org.springframework.context.annotation.Configuration;
33+
import org.springframework.http.HttpMethod;
34+
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
35+
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
36+
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
37+
38+
@Configuration
39+
@EnableWebSecurity
40+
public class SpringSecurityConfigurationBasicAuth extends WebSecurityConfigurerAdapter{
41+
42+
@Override
43+
protected void configure(HttpSecurity http) throws Exception {
44+
http
45+
.csrf().disable()
46+
.authorizeRequests()
47+
.antMatchers(HttpMethod.OPTIONS,"/**").permitAll()
48+
.anyRequest().authenticated()
49+
.and()
50+
//.formLogin().and()
51+
.httpBasic();
52+
}
53+
}
54+
```
55+
56+
57+
### Spring Boot 3
58+
2759
```
28-
package com.in28minutes.rest.basic.auth;
60+
package com.in28minutes.rest.webservices.restfulwebservices.basic.auth;
2961
3062
import org.springframework.context.annotation.Bean;
3163
import org.springframework.context.annotation.Configuration;

0 commit comments

Comments
 (0)
Please sign in to comment.