Skip to content

Commit 757bdd0

Browse files
committed
Support comma-separated Google client IDs
1 parent 8baa330 commit 757bdd0

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

ontime-back/docs/deployment/ec2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The workflow builds a Docker image, pushes it to GHCR, uploads `docker-compose.y
3030
- `JWT_ACCESS_HEADER`
3131
- `JWT_REFRESH_HEADER`
3232
- `GOOGLE_WEB_CLIENT_ID`
33-
- `GOOGLE_APP_CLIENT_ID`
33+
- `GOOGLE_APP_CLIENT_ID` (comma-separated iOS and Android client IDs when both platforms are enabled)
3434
- `APPLE_CLIENT_ID`
3535
- `APPLE_LOGIN_KEY`
3636
- `APPLE_TEAM_ID`

ontime-back/src/main/java/devkor/ontime_back/global/oauth/google/GoogleLoginService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.List;
3636
import java.util.Optional;
3737
import java.util.UUID;
38+
import java.util.stream.Stream;
3839

3940
@Slf4j
4041
@Service
@@ -58,7 +59,13 @@ public GoogleLoginService(
5859
this.jwtTokenProvider = jwtTokenProvider;
5960
this.userRepository = userRepository;
6061
this.userAlarmSettingRepository = userAlarmSettingRepository;
61-
this.validClientIds = List.of(webClientId, appClientId);
62+
this.validClientIds = Stream.concat(
63+
Stream.of(webClientId),
64+
Stream.of(appClientId.split(","))
65+
)
66+
.map(String::trim)
67+
.filter(clientId -> !clientId.isBlank())
68+
.toList();
6269
}
6370

6471

ontime-back/src/main/resources/application-prod.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ spring.flyway.baseline-on-migrate=false
1919
logging.level.root=INFO
2020
logging.level.devkor.ontime_back=INFO
2121

22+
# Google OAuth
23+
google.web.client-id=${GOOGLE_WEB_CLIENT_ID}
24+
google.app.client-id=${GOOGLE_APP_CLIENT_ID}
25+
2226
# Actuator
2327
management.endpoint.health.probes.enabled=true
2428
management.endpoints.web.exposure.include=health

0 commit comments

Comments
 (0)