Skip to content

Commit

Permalink
FIX :: 권한처리
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunSu1768 committed Mar 29, 2024
1 parent 788f51d commit 9ca3b10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xquare.app.xquareinfra.domain.deploy.adapter.dto.request

data class ApproveDeployRequest(
val accessKey: String,
val secretKey: String
)
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package xquare.app.xquareinfra.domain.deploy.application.service

import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import xquare.app.xquareinfra.domain.deploy.adapter.dto.request.ApproveDeployRequest
import xquare.app.xquareinfra.domain.deploy.application.port.`in`.ApproveDeployUseCase
import xquare.app.xquareinfra.domain.deploy.application.port.out.FindDeployPort
import xquare.app.xquareinfra.infrastructure.exception.BusinessLogicException
import xquare.app.xquareinfra.infrastructure.exception.XquareException

@Transactional
@Service
class ApproveDeployService(
@Value("\${secret.accessKey}")
private val accessKey: String,
private val findDeployPort: FindDeployPort
): ApproveDeployUseCase {

override fun approveDeploy(deployNameEn: String, req: ApproveDeployRequest) {
if(req.accessKey != accessKey) {
throw XquareException.FORBIDDEN
}
val deploy = findDeployPort.findByDeployName(deployNameEn) ?: throw BusinessLogicException.DEPLOY_NOT_FOUND
deploy.updateSecret(req.secretKey)
deploy.approveDeploy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class RequestPermitConfig : SecurityConfigurerAdapter<DefaultSecurityFilterChain
requestMatchers(CorsUtils::isCorsRequest).permitAll()
.antMatchers("/team").permitAll()
.antMatchers("/auth/**").permitAll()
.antMatchers("/deploy/**/approve").permitAll()
anyRequest().authenticated()
}
}
Expand Down

0 comments on commit 9ca3b10

Please sign in to comment.