-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: security permition to all endpoints
- Loading branch information
Showing
3 changed files
with
49 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/greenfoxacademy/backend/config/SecurityConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.greenfoxacademy.backend.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.security.web.SecurityFilterChain; | ||
|
||
import static org.springframework.security.config.Customizer.withDefaults; | ||
Check warning on line 9 in backend/src/main/java/com/greenfoxacademy/backend/config/SecurityConfig.java GitHub Actions / build
|
||
|
||
@Configuration | ||
Check warning on line 11 in backend/src/main/java/com/greenfoxacademy/backend/config/SecurityConfig.java GitHub Actions / build
|
||
@EnableWebSecurity(debug = true) | ||
public class SecurityConfig { | ||
|
||
@Bean | ||
Check warning on line 15 in backend/src/main/java/com/greenfoxacademy/backend/config/SecurityConfig.java GitHub Actions / build
|
||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { | ||
// @formatter:off | ||
http | ||
.authorizeHttpRequests((authorize) -> authorize | ||
.anyRequest().permitAll() | ||
) | ||
.httpBasic(withDefaults()) | ||
.formLogin(withDefaults()); | ||
// @formatter:on | ||
return http.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters