Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7e1fd0d
Spring_Security_기본_설정 : feat : kotlinLogging 의존성 추가 https://github.co…
Chuseok22 Jan 5, 2026
129c64c
Spring_Security_기본_설정 : feat : CustomException 커스텀 예외처리 로직 추가 https:/…
Chuseok22 Jan 6, 2026
98f452b
Spring_Security_기본_설정 : feat : 전역 예외 핸들러 추가 https://github.com/Campus…
Chuseok22 Jan 6, 2026
b805e19
Spring_Security_기본_설정 : feat : 인증 토큰 관련 인터페이스 추가 https://github.com/C…
Chuseok22 Jan 6, 2026
f9256f8
Spring_Security_기본_설정 : feat : [auth모듈] jjwt 의존성 추가 https://github.co…
Chuseok22 Jan 6, 2026
b8c301a
Spring_Security_기본_설정 : feat : JWT 관련 프로퍼티 추가 https://github.com/Camp…
Chuseok22 Jan 6, 2026
7980252
Spring_Security_기본_설정 : feat : JwtProvider.kt 추가 https://github.com/C…
Chuseok22 Jan 6, 2026
a33325e
Spring_Security_기본_설정 : feat : kotlin 및 swagger-ui 버전 수정 https://gith…
Chuseok22 Jan 6, 2026
6916bf1
Spring_Security_기본_설정 : feat : 메서드 카멜케이스 변경 https://github.com/Campus…
Chuseok22 Jan 9, 2026
6ce26cd
Spring_Security_기본_설정 : feat : Redis 모듈 추가 https://github.com/CampusT…
Chuseok22 Jan 9, 2026
10c022f
Spring_Security_기본_설정 : feat : [redis모듈] Redis 관련 환경설정 및 Properties 추…
Chuseok22 Jan 9, 2026
ce77e7f
Spring_Security_기본_설정 : feat : [auth모듈] redis 의존성 추가 https://github.c…
Chuseok22 Jan 9, 2026
68ef431
Spring_Security_기본_설정 : feat : CorsConfig 추가 https://github.com/Campu…
Chuseok22 Jan 9, 2026
55ab325
Spring_Security_기본_설정 : feat : SecurityUrls 추가 https://github.com/Cam…
Chuseok22 Jan 9, 2026
d32bb1e
Spring_Security_기본_설정 : feat : JwtConfig 추가 https://github.com/Campus…
Chuseok22 Jan 9, 2026
8fc4bc2
Spring_Security_기본_설정 : feat : JwtStore 추가 https://github.com/CampusT…
Chuseok22 Jan 9, 2026
72ca88a
Spring_Security_기본_설정 : feat : [web모듈] 컴포넌트 스캔 범위 와일드카드 수정 https://gi…
Chuseok22 Jan 9, 2026
1c2e0e2
Spring_Security_기본_설정 : feat : JwtConfig 수정 및 redisTemplate 직렬화 설정 수정…
Chuseok22 Jan 9, 2026
36e80a3
Spring_Security_기본_설정 : feat : JPA Auditing 활성화 https://github.com/Ca…
Chuseok22 Jan 9, 2026
77cb58f
Spring_Security_기본_설정 : feat : 전역 Clock 관리를 위한 Bean 등록 https://github…
Chuseok22 Jan 9, 2026
0dcf5a4
Spring_Security_기본_설정 : feat : AuthConstants.kt API 경로 추가 https://git…
Chuseok22 Jan 11, 2026
53589da
Spring_Security_기본_설정 : feat : JPA Auditing 을 위한 BaseEntity.kt 추상클래스 …
Chuseok22 Jan 11, 2026
6502ecb
Spring_Security_기본_설정 : feat : BaseEntity.kt 패키지 오타 수정 https://github…
Chuseok22 Jan 11, 2026
f338ad0
Spring_Security_기본_설정 : feat : Member.kt 엔티티 추가 https://github.com/Ca…
Chuseok22 Jan 11, 2026
9c1a4aa
Spring_Security_기본_설정 : feat : MemberRepository.kt 추가 https://github.…
Chuseok22 Jan 11, 2026
3953d8a
Spring_Security_기본_설정 : feat : [auth모듈] member 모듈 의존 https://github.c…
Chuseok22 Jan 11, 2026
8c0b5b3
Spring_Security_기본_설정 : feat : Member.kt 엔티티 필드 lateinit 설정 https://g…
Chuseok22 Jan 12, 2026
5ae411c
Spring_Security_기본_설정 : feat : MemberRepository.kt username 기반 조회 시 s…
Chuseok22 Jan 12, 2026
f698aaf
Spring_Security_기본_설정 : feat : Spring Security 기본 사용자 코드 생성 https://g…
Chuseok22 Jan 12, 2026
ce6ad6c
Spring_Security_기본_설정 : feat : Spring Security 기본 인터페이스 생성 https://gi…
Chuseok22 Jan 12, 2026
5edd14a
Spring_Security_기본_설정 : feat : Member.kt Role 필드 기본값 지정 https://githu…
Chuseok22 Jan 12, 2026
68e301f
Spring_Security_기본_설정 : feat : JWT 내부 role 데이터 제거 https://github.com/…
Chuseok22 Jan 12, 2026
dd90e6d
Spring_Security_기본_설정 : feat : MemberRepository.kt pk 기반 조회 로직 추가 htt…
Chuseok22 Jan 12, 2026
49535c7
Spring_Security_기본_설정 : feat : MemberService.kt 추가 https://github.com…
Chuseok22 Jan 12, 2026
0e59ed6
Spring_Security_기본_설정 : feat : JWT 인증 필터 TokenAuthenticationFilter.kt…
Chuseok22 Jan 12, 2026
343279d
Spring_Security_기본_설정 : feat : SecurityConfig.kt 작성 https://github.co…
Chuseok22 Jan 12, 2026
33c93ca
Spring_Security_기본_설정 : feat : 엔티티 Boolean 타입 네이밍 is 접두사 제거 https://g…
Chuseok22 Jan 12, 2026
7d7092c
Spring_Security_기본_설정 : feat : cicd.yml 트리거 푸시 브랜치 주석 제거 https://gith…
Chuseok22 Jan 12, 2026
902caac
Spring_Security_기본_설정 : feat : jwt runtime 의존성 추가 https://github.com/…
Chuseok22 Jan 12, 2026
a38a36b
Spring_Security_기본_설정 : feat : 예외처리 개선 https://github.com/CampusTable…
Chuseok22 Jan 12, 2026
9f76e03
Spring_Security_기본_설정 : feat : JWT 내부 memberId 추출 로직 변경 https://githu…
Chuseok22 Jan 12, 2026
26abfab
Spring_Security_기본_설정 : feat : CustomUserDetails.kt 내부 memberId 초기화 문…
Chuseok22 Jan 12, 2026
0ed5bee
Spring_Security_기본_설정 : feat : ErrorCode 에러 메시지 개선 https://github.com…
Chuseok22 Jan 12, 2026
113df9b
Spring_Security_기본_설정 : feat : objectMapper 특정 패키지 기준 지원 https://gith…
Chuseok22 Jan 12, 2026
b6bf452
Spring_Security_기본_설정 : feat : Dockerfile .jar 파일 위치 수정 https://githu…
Chuseok22 Jan 12, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/spring-boot-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: spring-boot-cicd
on:
push:
branches:
# - main
- main

env:
PROJECT_NAME: campus-table
Expand Down
13 changes: 12 additions & 1 deletion CT-auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,19 @@ tasks.jar {

dependencies {
implementation(project(":CT-common"))
implementation(project(":CT-member"))
implementation(project(":CT-redis"))

// Spring Security
api(libs.spring.boot.starter.security)
api(libs.spring.security.test)
implementation(libs.spring.security.test)

// JWT
implementation(libs.jjwt.api)
runtimeOnly(libs.jjwt.impl)
runtimeOnly(libs.jjwt.jackson)

// Sejong Portal Login
implementation(libs.sejong.portal.login)
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.chuseok22.ctauth.core.token

import java.util.*

interface TokenProvider {

/**
* accessToken 생성
*/
fun createAccessToken(memberId: String): String

/**
* refreshToken 생성
*/
fun createRefreshToken(memberId: String): String

/**
* 토큰 유효 검사
*/
fun isValidToken(token: String): Boolean

/**
* 토큰에서 memberId 파싱
*/
fun getMemberId(token: String): String

/**
* 토큰 만료시간 반환 (ms)
*/
fun getExpiredAt(token: String): Date
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.chuseok22.ctauth.core.token

interface TokenStore {

/**
* 리프레시 토큰을 주어진 Key로 저장하고 TTL(ms) 설정
*/
fun save(key: String, refreshToken: String, ttlMillis: Long)

/**
* Key에 해당하는 리프레시 토큰 삭제
*/
fun remove(key: String)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.chuseok22.ctauth.core.user

interface UserPrincipal {

/**
* 회원 고유 ID
*/
fun getMemberId(): String

/**
* 로그인 ID
*/
fun getUsername(): String

/**
* 사용자 권한
*/
fun getRoles(): List<String>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.chuseok22.ctauth.infrastructure.config

import com.chuseok22.ctauth.infrastructure.jwt.JwtProvider
import com.chuseok22.ctauth.infrastructure.jwt.JwtStore
import com.chuseok22.ctauth.infrastructure.properties.JwtProperties
import io.jsonwebtoken.io.Decoders
import io.jsonwebtoken.security.Keys
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.data.redis.core.RedisTemplate
import javax.crypto.SecretKey

@Configuration
@EnableConfigurationProperties(JwtProperties::class)
class JwtConfig(
private val properties: JwtProperties
) {

/**
* JWT 서명에 사용할 secretKey 생성
* base64로 인코딩 된 secretKey를 디코딩해서 SecretKey 객체 생성
*/
@Bean
fun jwtSecretKey(): SecretKey {
val keyBytes: ByteArray = Decoders.BASE64.decode(properties.secretKey)
return Keys.hmacShaKeyFor(keyBytes)
}

/**
* TokenProvider 구현체 Bean 등록
*/
@Bean
fun jwtProvider(jwtSecretKey: SecretKey): JwtProvider {
return JwtProvider(jwtSecretKey, properties)
}

/**
* TokenStore 구현체 Bean 등록
*/
@Bean
fun jwtStore(redisTemplate: RedisTemplate<String, String>): JwtStore {
return JwtStore(redisTemplate)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.chuseok22.ctauth.infrastructure.config

import com.chuseok22.ctauth.core.token.TokenProvider
import com.chuseok22.ctauth.infrastructure.constant.SecurityUrls
import com.chuseok22.ctauth.infrastructure.filter.TokenAuthenticationFilter
import com.chuseok22.ctmember.application.MemberService
import com.fasterxml.jackson.databind.ObjectMapper
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
import org.springframework.security.config.http.SessionCreationPolicy
import org.springframework.security.web.SecurityFilterChain
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter

@Configuration
@EnableWebSecurity
class SecurityConfig(
private val tokenProvider: TokenProvider,
private val memberService: MemberService,
private val objectMapper: ObjectMapper
) {
/**
* SecurityFilterChain 설정
*/
@Bean
fun filterChain(http: HttpSecurity, tokenAuthenticationFilter: TokenAuthenticationFilter): SecurityFilterChain {
return http
.cors {}
.csrf { it.disable() }
.httpBasic { it.disable() }
.formLogin { it.disable() }

.authorizeHttpRequests { authorize ->
authorize
// AUTH_WHITELIST 에 등록된 URL은 인증 허용
.requestMatchers(*SecurityUrls.AUTH_WHITELIST.toTypedArray()).permitAll()
.anyRequest().authenticated()
}

// 세션 설정 (STATELESS)
.sessionManagement { session ->
session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
}

.addFilterBefore(
tokenAuthenticationFilter,
UsernamePasswordAuthenticationFilter::class.java
)
.build()
}

@Bean
fun tokenAuthenticationFilter(): TokenAuthenticationFilter {
return TokenAuthenticationFilter(tokenProvider, memberService, objectMapper)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.chuseok22.ctauth.infrastructure.constant

object AuthConstants {

// Auth
const val TOKEN_PREFIX: String = "Bearer "
const val HEADER_AUTHORIZATION: String = "Authorization"

// CookieUtil
const val ROOT_DOMAIN: String = "campustable.shop"
const val ACCESS_TOKEN_KEY: String = "accessToken"
const val REFRESH_TOKEN_KEY: String = "refreshToken"

// JwtUtil
const val ACCESS_TOKEN_CATEGORY: String = "accessToken"
const val REFRESH_TOKEN_CATEGORY: String = "refreshToken"
const val REDIS_REFRESH_TOKEN_KEY_PREFIX: String = "RT:"

// API
const val API_REQUEST_PREFIX: String = "/api/"
const val ADMIN_REQUEST_PREFIX: String = "/admin/"
const val TEST_REQUEST_PREFIX: String = "/test/"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.chuseok22.ctauth.infrastructure.constant

object SecurityUrls {

/**
* 인증을 생략할 URL 패턴 목록
*/
@JvmStatic
val AUTH_WHITELIST = listOf(
// AUTH
"/api/auth/login",
"/api/auth/reissue",

// Swagger
"/docs/swagger-ui/**",
"/v3/api-docs/**",
)
}
Loading