Skip to content

Commit 8d4e21a

Browse files
is it ok
1 parent dfafaf2 commit 8d4e21a

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

backend/src/main/java/com/caesarjlee/caesarfinancialtracker/configurations/SecurityConfiguration.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws
3434
.sessionManagement(
3535
session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
3636
.authorizeHttpRequests(
37-
authentication
38-
-> authentication
39-
.requestMatchers(HttpMethod.OPTIONS, "/**")
40-
.permitAll()
41-
.requestMatchers(HttpMethod.POST, "/api/alpha/profiles/register", "/api/alpha/profiles/login")// public endpoints
42-
.permitAll()
43-
.anyRequest()// everything else requires JWT
44-
.authenticated())
37+
authentication -> authentication
38+
.requestMatchers(HttpMethod.OPTIONS, "/**")//allow CORS preflight for all endpoints
39+
.permitAll()
40+
.requestMatchers(HttpMethod.POST, "/profiles/register", "/profiles/login")
41+
.permitAll()
42+
.anyRequest()// everything else requires JWT
43+
.authenticated())
4544
.authenticationProvider(authenticationProvider())
4645
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);// JWT filter
4746
return httpSecurity.build();

backend/src/main/resources/application.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ spring:
1212
properties:
1313
hibernate:
1414
format_sql: true #format SQL statements
15-
#render injects show-sql, and show SQL statements 4 development
1615
show-sql: ${SHOW_SQL:false}
17-
database-platform: ${SPRING_JPA_DATABASE_PLATFORM}
1816

1917
server:
20-
#render injects PORT, and use port 1989 for development
2118
port: ${PORT:1989} #memorize Tiananmen Square protests that happened in June 4, 1989
2219
servlet:
2320
context-path: /api/alpha #API path for version alpha
2421

2522
app:
2623
cors:
27-
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:5173} #developed and deployed locations
24+
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:5173}
2825

2926
jwt:
3027
secret: ${JWT_SECRET}

0 commit comments

Comments
 (0)