Skip to content

Commit

Permalink
Revert "[feat/CK-239]� Amazon S3 접근 시 credential 정보를 이용하도록 수정한다 (#200)…
Browse files Browse the repository at this point in the history
…" (#202)

This reverts commit 3f5cbe3.
  • Loading branch information
younghoondoodoom authored Dec 3, 2023
1 parent 3f5cbe3 commit b9f89fc
Show file tree
Hide file tree
Showing 245 changed files with 1,601 additions and 3,100 deletions.
9 changes: 2 additions & 7 deletions backend/kirikiri/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ jacocoTestReport {
"**/*Request*",
"**/*Response*",
"**/*Interceptor*",
"**/*Exception*",
"**/*Mapper*"
"**/*Exception*"
] + QDomains)
})
)
Expand Down Expand Up @@ -123,8 +122,7 @@ jacocoTestCoverageVerification {
"**.*Request*",
"**.*Response*",
"**.*Interceptor*",
"**.*Exception*",
"**.*Mapper*"
"**.*Exception*"
] + QDomains
}
}
Expand Down Expand Up @@ -170,9 +168,6 @@ dependencies {
// flyway
implementation 'org.flywaydb:flyway-mysql'

// redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

// test
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
11 changes: 0 additions & 11 deletions backend/kirikiri/src/docs/asciidoc/auth.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,3 @@ operation::auth-create-api-test/토큰_재발행_시_토큰이_만료_됐을_때
=== *2-4* 실패 - 토큰 재발행 시 토큰이 유효하지 않을 때

operation::auth-create-api-test/토큰_재발행_시_토큰이_유효하지_않을_때_예외를_던진다[snippets='http-request,http-response']

[[네이버OAuth로그인-API]]
== *3. 네이버 OAuth 로그인*

=== *3-1* 성공 - 네이버 로그인 페이지 리다이렉트를 성공한다

operation::auth-create-api-test/네이버_로그인_페이지를_정상적으로_반환한다[snippets='http-request,http-response,response-fields']

=== *3-2* 성공 - 네이버 사용자 정보 요청을 성공한다

operation::auth-create-api-test/네이버에서_콜백요청을_받아_사용자_정보를_반환한다[snippets='http-request,http-response']
16 changes: 12 additions & 4 deletions backend/kirikiri/src/docs/asciidoc/goalroom.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,27 @@ operation::goal-room-create-api-test/골룸_생성_시_삭제된_로드맵_경

operation::goal-room-create-api-test/골룸_생성_시_존재하지_않는_회원일_경우[snippets='http-request,http-response']

=== *1-9* 실패 - 골룸 생성 시 골룸 노드의 시작 날짜가 오늘보다 전일 경우
=== *1-8* 실패 - 골룸 생성 시 골룸 투두의 시작 날짜가 오늘보다 전일 경우

operation::goal-room-create-api-test/골룸_생성_시_골룸_투두의_시작_날짜가_오늘보다_전일_경우[snippets='http-request,http-response']

=== *1-9* 실패 - 골룸 생성 시 골룸 투두의 시작 날짜보다 종료 날짜가 빠른 경우

operation::goal-room-create-api-test/골룸_생성_시_골룸_투두의_시작_날짜보다_종료_날짜가_빠른_경우[snippets='http-request,http-response']

=== *1-10* 실패 - 골룸 생성 시 골룸 노드의 시작 날짜가 오늘보다 전일 경우

operation::goal-room-create-api-test/골룸_생성_시_골룸_노드의_시작_날짜가_오늘보다_전일_경우[snippets='http-request,http-response']

=== *1-10* 실패 - 골룸 생성 시 골룸 노드의 시작 날짜보다 종료 날짜가 빠른 경우
=== *1-11* 실패 - 골룸 생성 시 골룸 노드의 시작 날짜보다 종료 날짜가 빠른 경우

operation::goal-room-create-api-test/골룸_생성_시_골룸_노드의_시작_날짜보다_종료_날짜가_빠른_경우[snippets='http-request,http-response']

=== *1-11* 실패 - 골룸 생성 시 골룸 노드의 인증 횟수가 0보다 작을 경우
=== *1-12* 실패 - 골룸 생성 시 골룸 노드의 인증 횟수가 0보다 작을 경우

operation::goal-room-create-api-test/골룸_생성_시_골룸_노드의_인증_횟수가_0보다_작을_경우[snippets='http-request,http-response']

=== *1-12* 실패 - 골룸 생성 시 골룸 노드의 인증 횟수가 기간보다 클 경우
=== *1-13* 실패 - 골룸 생성 시 골룸 노드의 인증 횟수가 기간보다 클 경우

operation::goal-room-create-api-test/골룸_생성_시_골룸_노드의_인증_횟수가_기간보다_클_경우[snippets='http-request,http-response']

Expand Down
22 changes: 15 additions & 7 deletions backend/kirikiri/src/docs/asciidoc/member.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,37 @@ operation::member-create-api-test/회원가입_시_비밀번호가_형식에_맞

operation::member-create-api-test/회원가입_시_닉네임이_형식에_맞지않을때[snippets='http-request,http-response']

=== *1-5* 실패 - 중복된 아이디일 때
=== *1-5* 실패 - 전화번호 형식에 맞지 않을 때

operation::member-create-api-test/회원가입_시_전화번호_형식에_맞지않을때[snippets='http-request,http-response']

=== *1-6* 실패 - 중복된 아이디일 때

operation::member-create-api-test/회원가입_시_중복된_닉네임일_때[snippets='http-request,http-response']

=== *1-6* 실패 - 중복된 닉네임일 때
=== *1-7* 실패 - 중복된 닉네임일 때

operation::member-create-api-test/회원가입_시_중복된_아이디일_때[snippets='http-request,http-response']

=== *1-7* 실패 - 회원가입 시 아이디에 빈값이 들어올 때
=== *1-8* 실패 - 회원가입 시 아이디에 빈값이 들어올 때

operation::member-create-api-test/회원가입_시_아이디에_빈값이_들어올_때[snippets='http-request,http-response']

=== *1-8* 실패 - 회원가입 시 비밀번호에 빈값이 들어올 때
=== *1-9* 실패 - 회원가입 시 비밀번호에 빈값이 들어올 때

operation::member-create-api-test/회원가입_시_비밀번호에_빈값이_들어올_때[snippets='http-request,http-response']

=== *1-9* 실패 - 회원가입 할 때 닉네임에 빈값이 들어올 때
=== *1-10* 실패 - 회원가입 할 때 닉네임에 빈값이 들어올 때

operation::member-create-api-test/회원가입_시_닉네임에_빈값이_들어올_때[snippets='http-request,http-response']

=== *1-10* 실패 - 회원가입_시_아이디_비밀번호_닉네임_이메일_필드에_빈값이_들어올_때
=== *1-11* 실패 - 회원가입 시 전화번호에 빈값이 들어올 때

operation::member-create-api-test/회원가입_시_전화번호에_빈값이_들어올_때[snippets='http-request,http-response']

=== *1-12* 실패 - 회원가입 시 아이디 비밀번호 닉네임 전화번호 필드에 빈값이 들어올 때

operation::member-create-api-test/회원가입_시_아이디_비밀번호_닉네임_이메일_필드에_빈값이_들어올_때[snippets='http-request,http-response']
operation::member-create-api-test/회원가입_시_아이디_비밀번호_닉네임_전화번호_필드에_빈값이_들어올_때[snippets='http-request,http-response']

[[사용자정보조회-API]]
== *2. 사용자 정보 조회*
Expand Down
20 changes: 20 additions & 0 deletions backend/kirikiri/src/docs/asciidoc/overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@

|===

[[overview-page-response]]
=== *Page Response Data*

|===
| Field Name | Type | Description

| currentPage
| int
| 현재 페이지 값

| totalPage
| int
| 총 페이지 값

| data
| Object
| 데이터 리스트

|===

[[overview-error-response]]
=== *Error Response Data*

Expand Down
19 changes: 0 additions & 19 deletions backend/kirikiri/src/docs/asciidoc/roadmap.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,3 @@ operation::roadmap-create-api-test/로드맵_삭제시_존재하지_않는_로
=== *10-3* 실패 - 자신이 생성한 로드맵이 아닌 경우

operation::roadmap-create-api-test/로드맵_삭제시_자신이_생성한_로드맵이_아닌_경우_예외가_발생한다[snippets='http-request,http-response,response-fields']

[[로드맵카테고리생성-API]]
== *11. 로드맵 카테고리 생성 API*

=== *11-1* 성공

operation::roadmap-create-api-test/정상적으로_로드맵_카테고리를_생성한다[snippets='http-request,request-fields,http-response']

=== *11-2* 로드맵 카테고리 생성 시 카테고리 이름이 빈값일 경우

operation::roadmap-create-api-test/로드맵_카테고리_생성_시_카테고리_이름이_빈값일_경우[snippets='http-request,request-fields,http-response']

=== *11-3* 로드맵 카테고리 생성 시 카테고리 이름이 10자 초과일 경우

operation::roadmap-create-api-test/로드맵_카테고리_생성_시_카테고리_이름이_10자_초과일_경우[snippets='http-request,request-fields,http-response']

=== *11-4* 로드맵 카테고리 생성 시 카테고리 이름이 중복될 경우

operation::roadmap-create-api-test/로드맵_카테고리_생성_시_카테고리_이름이_중복될_경우[snippets='http-request,request-fields,http-response']
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package co.kirikiri.common.config;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
Expand All @@ -13,23 +11,15 @@
public class AWSConfig {

private final Regions region;
private final String accessKey;
private final String secretKey;

public AWSConfig(@Value("${cloud.aws.region.static}") final String region,
@Value("${cloud.aws.credentials.access-key}") final String accessKey,
@Value("${cloud.aws.credentials.secret-key}") final String secretKey) {
public AWSConfig(@Value("${cloud.aws.region.static}") final String region) {
this.region = Regions.fromName(region);
this.accessKey = accessKey;
this.secretKey = secretKey;
}

@Bean
public AmazonS3 amazonS3() {
final BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
return AmazonS3ClientBuilder.standard()
.withRegion(region)
.withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package co.kirikiri.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@Configuration
@EnableJpaAuditing
public class JpaConfig {

}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import co.kirikiri.common.interceptor.AuthInterceptor;
import co.kirikiri.common.resolver.MemberIdentifierArgumentResolver;
import co.kirikiri.common.resolver.RoadmapSaveArgumentResolver;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;

@Configuration
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.kirikiri.common.interceptor;

import co.kirikiri.service.auth.AuthService;
import co.kirikiri.service.exception.AuthenticationException;
import co.kirikiri.exception.AuthenticationException;
import co.kirikiri.service.AuthService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package co.kirikiri.common.resolver;

import co.kirikiri.common.interceptor.Authenticated;
import co.kirikiri.service.auth.AuthService;
import co.kirikiri.service.exception.AuthenticationException;
import co.kirikiri.service.exception.ServerException;
import co.kirikiri.exception.AuthenticationException;
import co.kirikiri.service.AuthService;
import lombok.RequiredArgsConstructor;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpHeaders;
Expand All @@ -23,9 +21,6 @@ public class MemberIdentifierArgumentResolver implements HandlerMethodArgumentRe

@Override
public boolean supportsParameter(final MethodParameter parameter) {
if (!parameter.hasMethodAnnotation(Authenticated.class)) {
throw new ServerException("MemberIdentifier는 인증된 사용자만 사용 가능합니다. (@Authenticated)");
}
return parameter.getParameterType().equals(String.class)
&& parameter.hasParameterAnnotation(MemberIdentifier.class);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package co.kirikiri.common.resolver;

import co.kirikiri.exception.BadRequestException;
import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest;
import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest;
import co.kirikiri.service.exception.BadRequestException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
package co.kirikiri.controller;

import co.kirikiri.service.auth.AuthService;
import co.kirikiri.service.auth.NaverOauthService;
import co.kirikiri.service.dto.auth.OauthRedirectResponse;
import co.kirikiri.service.AuthService;
import co.kirikiri.service.dto.auth.request.LoginRequest;
import co.kirikiri.service.dto.auth.request.ReissueTokenRequest;
import co.kirikiri.service.dto.auth.response.AuthenticationResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

@RestController
@RequestMapping("/auth")
@RequiredArgsConstructor
public class AuthController {

private final AuthService authService;
private final NaverOauthService naverOauthService;

@PostMapping("/login")
public ResponseEntity<AuthenticationResponse> login(@RequestBody @Valid final LoginRequest request) {
Expand All @@ -37,22 +31,4 @@ public ResponseEntity<AuthenticationResponse> reissue(@RequestBody @Valid final
return ResponseEntity.ok(response);
}

@GetMapping("/oauth/naver")
public ResponseEntity<OauthRedirectResponse> loginOauth() {
final OauthRedirectResponse oauthRedirectResponse = naverOauthService.makeOauthUrl();
return ResponseEntity.ok(oauthRedirectResponse);
}

@GetMapping("/login/oauth")
public ResponseEntity<AuthenticationResponse> loginOauth(
@RequestParam(value = "code") final String code,
@RequestParam("state") final String state) {
final Map<String, String> queryParams = Map.of(
"code", code,
"state", state,
"grant_type", "authorization_code"
);
final AuthenticationResponse response = naverOauthService.login(queryParams);
return ResponseEntity.ok(response);
}
}
Loading

0 comments on commit b9f89fc

Please sign in to comment.