Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.Customizer;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
Expand Down Expand Up @@ -67,6 +67,7 @@ public SecurityFilterChain swaggerFilterChain(HttpSecurity http) throws Exceptio
@Order(2)
public SecurityFilterChain apiFilterChain(HttpSecurity httpSecurity) throws Exception {
return httpSecurity
.securityMatcher("/api/**")
.csrf(AbstractHttpConfigurer::disable)
.cors(cors -> cors.configure(httpSecurity))
.formLogin(AbstractHttpConfigurer::disable)
Expand All @@ -80,10 +81,6 @@ public SecurityFilterChain apiFilterChain(HttpSecurity httpSecurity) throws Exce
.sessionManagement(sessionManagement ->
sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
.oauth2Login(Customizer.withDefaults())
.sessionManagement(session ->
session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
.exceptionHandling(handling -> handling
.authenticationEntryPoint((request, response, authException) -> {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
Expand Down
7 changes: 4 additions & 3 deletions Gathering_be/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ springdoc:
show-actuator: true
default-produces-media-type: application/json

swagger:
username: ${SWAGGER_USERNAME}
password: ${SWAGGER_PASSWORD}
gathering:
swagger:
username: ${SWAGGER_USERNAME}
password: ${SWAGGER_PASSWORD}

oauth2:
google:
Expand Down
1 change: 1 addition & 0 deletions Gathering_fe/src/components/GoogleRedirectHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const GoogleRedirectHandler: React.FC = () => {
const handleGoogleLogin = async () => {
if (code) {
try {
console.log(code);
const result = await googleLogin(code);

if (result?.success) {
Expand Down
4 changes: 2 additions & 2 deletions Gathering_fe/src/services/authApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export const googleLogin = async (accessToken: string) => {
if (response.data.status === 200) {
const { accessToken, refreshToken } = response.data.data;

cookies.set('accessToken', accessToken, { path: '/', secure: true, sameSite: 'strict' });
cookies.set('refreshToken', refreshToken, { path: '/', secure: true, sameSite: 'strict' });
cookies.set('accessToken', accessToken, { path: '/', secure: true, sameSite: 'lax' });
cookies.set('refreshToken', refreshToken, { path: '/', secure: true, sameSite: 'lax' });

return { success: true, message: response.data.message };
}
Expand Down