Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #401

Closed
wants to merge 13 commits into from
16 changes: 11 additions & 5 deletions src/main/kotlin/com/dotori/v2/aop/HttpLoggingAspect.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class HttpLoggingAspect {
private val log = LoggerFactory.getLogger(this.javaClass.name)

@Pointcut("within(@org.springframework.web.bind.annotation.RestController *)")
fun onRequest() {
}
fun onRequest() {}

@Around("onRequest()")
@Throws(Throwable::class)
Expand All @@ -47,24 +46,31 @@ class HttpLoggingAspect {
val headerName = headerNames.nextElement()
headerSet.add(headerName)
}

val code = UUID.randomUUID()
log.info(
"At {}#{} [Request:{}] IP: {}, Session-ID: {}, URI: {}, Params: {}, Content-Type: {}, User-Agent: {}, Headers: {}, Parameters: {}, Code: {}",
className,methodName,method,ip,sessionId,uri,params,contentType,userAgent,headerSet,params(proceedingJoinPoint),code
className, methodName, method, ip, sessionId, uri, params, contentType, userAgent, headerSet, params(proceedingJoinPoint), code
)
val result = proceedingJoinPoint.proceed()
when (result) {
is ResponseEntity<*> -> {
var body = result.body.toString()

if(body.length > 55) {
body = body.substring(0, 55)
}

log.info(
"At {}#{} [Response:{}] IP: {}, Session-ID: {}, Headers: {}, Response: {}, Status-Code: {}, Code: {}",
className,methodName,method,ip,sessionId,result.headers,result.body,result.statusCode,code
className, methodName, method, ip, sessionId, result.headers, body, result.statusCode, code
)
}

null -> {
log.info(
"At {}#{} [Response: null] IP: {}, Session-ID: {}, Code: {}",
className,methodName,ip,sessionId,code
className, methodName, ip, sessionId, code
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import org.springframework.web.bind.annotation.RestController
class HealthCheckController {

@GetMapping
fun healthCheck() = ResponseEntity.ok("Dotori-V2 Server running")
fun healthCheck() = ResponseEntity.ok("Dotori Server running")

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class GetSelfStudyInfoServiceImpl(
private val validDayOfWeekAndHourUtil: ValidDayOfWeekAndHourUtil,
private val userUtil: UserUtil
) : GetSelfStudyInfoService {

override fun execute(): SelfStudyInfoResDto {
val selfStudyCount = selfStudyCountRepository.findSelfStudyCountById(1)
val member = userUtil.fetchCurrentUser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ class SecurityConfig(
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeHttpRequests()

.antMatchers(HttpMethod.GET, "/").permitAll()

.antMatchers("/actuator/**").permitAll()
.antMatchers("/v2/auth/**").permitAll()
.antMatchers("/v2/health-check").permitAll()
.antMatchers("/v2/refresh").permitAll()

.antMatchers(HttpMethod.GET, "/v2/home/board").authenticated()
.antMatchers(HttpMethod.GET, "/v2/home").authenticated()

.antMatchers("/v2/admin/**").hasRole("ADMIN")
.antMatchers("/v2/member/**").hasRole("MEMBER")
.antMatchers("/v2/councillor/**").hasRole("COUNCILLOR")
Expand All @@ -57,12 +63,6 @@ class SecurityConfig(
.antMatchers("/v2/email/**").permitAll()

.antMatchers("/v2/members/**").authenticated()

.antMatchers(HttpMethod.GET, "/v2/home/board").authenticated()
.antMatchers(HttpMethod.GET, "/v2/home").authenticated()

.mvcMatchers(HttpMethod.GET, "/").permitAll()

.anyRequest().denyAll()
.and()
.exceptionHandling()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import org.springframework.stereotype.Component
import java.time.Duration
import java.time.LocalDateTime

@Aspect
@Component
//@Aspect
//@Component
class ReservationIndicatorAspect(
private val reservationIndicatorsRepository: ReservationIndicatorsRepository
) {
Expand Down
Loading