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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
testImplementation 'org.springframework.amqp:spring-rabbit-test'

// webflux; webclient
implementation 'org.springframework.boot:spring-boot-starter-webflux:3.4.5'
implementation 'org.springframework.boot:spring-boot-starter-webflux'

// batch
implementation 'org.springframework.boot:spring-boot-starter-batch'
Expand Down Expand Up @@ -97,7 +97,7 @@ dependencies {

// fcm
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.fasterxml.jackson.core:jackson-databind'
//implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.google.auth:google-auth-library-oauth2-http:1.18.0'
implementation 'com.google.firebase:firebase-admin:9.2.0'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.assu.server.domain.auth.service;

import com.assu.server.domain.auth.dto.verification.VerificationRequestDTO;

public interface VerificationService {
void checkPhoneNumberAvailability(
VerificationRequestDTO.PhoneVerificationCheckRequest request);

void checkEmailAvailability(
VerificationRequestDTO.EmailVerificationCheckRequest request);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.assu.server.domain.auth.service;

import com.assu.server.domain.auth.dto.verification.VerificationRequestDTO;
import com.assu.server.domain.auth.exception.CustomAuthException;
import com.assu.server.domain.auth.repository.CommonAuthRepository;
import com.assu.server.domain.member.repository.MemberRepository;
import com.assu.server.global.apiPayload.code.status.ErrorStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class VerificationServiceImpl implements VerificationService {

private final MemberRepository memberRepository;
private final CommonAuthRepository commonAuthRepository;

@Override
public void checkPhoneNumberAvailability(
VerificationRequestDTO.PhoneVerificationCheckRequest request) {

boolean exists = memberRepository.existsByPhoneNum(request.getPhoneNumber());

if (exists) {
throw new CustomAuthException(ErrorStatus.EXISTED_PHONE);
}
}

@Override
public void checkEmailAvailability(
VerificationRequestDTO.EmailVerificationCheckRequest request) {

boolean exists = commonAuthRepository.existsByEmail(request.getEmail());

if (exists) {
throw new CustomAuthException(ErrorStatus.EXISTED_EMAIL);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.assu.server.domain.certification.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;

import lombok.RequiredArgsConstructor;

// @EnableWebSocketMessageBroker
// @Configuration
// @RequiredArgsConstructor
// public class CertifyWebSocketConfig implements WebSocketMessageBrokerConfigurer {
//
// private final StompAuthChannelInterceptor stompAuthChannelInterceptor;
// @Override
// public void configureMessageBroker(MessageBrokerRegistry config) {
// config.enableSimpleBroker("/certification"); // 인증현황을 받아보기 위한 구독 주소
// config.setApplicationDestinationPrefixes("/app"); // 클라이언트가 인증 요청을 보내는 주소
// }
//
// @Override
// public void registerStompEndpoints(StompEndpointRegistry registry) {
// registry.addEndpoint("/ws-certify").setAllowedOriginPatterns("*"); // 클라이언트 WebSocket 연결 주소
// // .setAllowedOriginPatterns("http://10.0.2.2:8080", "ws://10.0.2.2:8080");// CORS 허용
// }
//
// @Override
// public void configureClientInboundChannel(ChannelRegistration registration) {
// registration.interceptors(stompAuthChannelInterceptor);
// }
//
// }
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,14 @@ public String getProfileImageUrl(Long memberId) {
Member member = memberRepository.findById(memberId)
.orElseThrow(() -> new CustomAuthException(ErrorStatus.NO_SUCH_MEMBER));

String keyOrUrl = member.getProfileUrl();
if (keyOrUrl == null || keyOrUrl.isBlank()) {
throw new CustomAuthException(ErrorStatus.PROFILE_IMAGE_NOT_FOUND);
}
String key = member.getProfileUrl(); // DB에 저장된 경로 (ex. members/17/profile/aaa.png)

if (keyOrUrl.startsWith("http://") || keyOrUrl.startsWith("https://")) {
return keyOrUrl;
}

String presigned = amazonS3Manager.generatePresignedUrl(keyOrUrl);
if (presigned == null) {
if (key == null || key.isBlank()) {
throw new CustomAuthException(ErrorStatus.PROFILE_IMAGE_NOT_FOUND);
}
return presigned;

// S3 주소 리턴
return "https://assu-bucket.s3.ap-northeast-2.amazonaws.com/" + key;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public SecurityFilterChain filterChain(HttpSecurity http, JwtAuthFilter jwtAuthF
"/auth/students/login",
"/auth/tokens/refresh",
"/auth/students/ssu-verify",
"/map/place"
"/map/place",
"/member/inquiries/{inquiry-id}/answer"
).permitAll()
.requestMatchers("/ws/**").permitAll()
// 나머지는 인증 필요
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public FcmResult sendToMemberId(Long memberId, String title, String body, Map<St
String deeplink = data != null ? data.getOrDefault("deeplink", "") : "";
String notificationId = data != null ? data.getOrDefault("notificationId", "") : "";

// 3) 멀티캐스트 메시지 구성 (data-only + HIGH)
com.google.firebase.messaging.MulticastMessage msg =
com.google.firebase.messaging.MulticastMessage.builder()
.addAllTokens(tokens)
Expand Down