application.md 내용
spring: profiles: active: prod application: name: webty
security: oauth2: client: registration: kakao: client-id:
OAUTHKAKAOCLIENTIDclient − secret:
{OAUTH_KAKAO_CLIENT_SECRET} scope: profile_nickname authorization-grant-type: authorization_code redirect-uri: ${OAUTH_KAKAO_REDIRECT_URI} client-name: Kakao client-authentication-method: client_secret_post
provider:
kakao:
authorization-uri: https://kauth.kakao.com/oauth/authorize
token-uri: https://kauth.kakao.com/oauth/token
user-info-uri: https://kapi.kakao.com/v2/user/me
user-name-attribute: id
jwt: secret: V4r8jL3wqCz7oP7Y7Jl2kJcB9QxZlH4sRmGgqT9PZ8fF0e1yP1zDgT3zK7Qw3Fw redirect: http://localhost:3000/callback access-token: expiration-time: 3600000 refresh-token: expiration-time: 604800000
이 설정 파일을 각 섹션별로 설명해드리겠습니다:
spring:
profiles:
active: prod # 운영 환경 프로필 사용
application:
name: webty # 애플리케이션 이름
security:
oauth2:
client:
registration:
kakao:
client-id: OAUTH_KAKAO_CLIENT_ID # 카카오 개발자 센터에서 발급받은 클라이언트 ID
client-secret: {OAUTH_KAKAO_CLIENT_SECRET} # 카카오 개발자 센터에서 발급받은 시크릿 키
scope: profile_nickname # 요청할 사용자 정보 범위
authorization-grant-type: authorization_code # OAuth2 인증 방식
redirect-uri: ${OAUTH_KAKAO_REDIRECT_URI} # 인증 후 리다이렉트될 URI
client-name: Kakao # 클라이언트 이름
client-authentication-method: client_secret_post # 클라이언트 인증 방식
provider:
kakao:
authorization-uri: https://kauth.kakao.com/oauth/authorize # 카카오 인증 URL
token-uri: https://kauth.kakao.com/oauth/token # 토큰 발급 URL
user-info-uri: https://kapi.kakao.com/v2/user/me # 사용자 정보 조회 URL
user-name-attribute: id # 사용자 식별자 필드
jwt:
secret: V4r8jL3wqCz7oP7Y7Jl2kJcB9QxZlH4sRmGgqT9PZ8fF0e1yP1zDgT3zK7Qw3Fw # JWT 암호화 키
redirect: http://localhost:3000/callback # 프론트엔드 리다이렉트 URI
access-token:
expiration-time: 3600000 # 액세스 토큰 만료 시간 (1시간)
refresh-token:
expiration-time: 604800000 # 리프레시 토큰 만료 시간 (7일)
이 설정은 다음과 같은 기능을 지원합니다:
1. 카카오 소셜 로그인 구현
2. JWT 기반의 인증 처리
3. 토큰 만료 시간 관리
4. 보안 관련 설정
실제 사용 예시:
@Value("${jwt.secret}")
private String jwtSecret; // JWT 시크릿 키 주입
@Value("${security.oauth2.client.registration.kakao.client-id}")
private String kakaoClientId; // 카카오 클라이언트 ID 주입
이 설정들은 보안에 민감하므로 실제 값들은 환경 변수나 외부 설정으로 관리하는 것이 좋습니다.