-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor]: gallery, 인증 도메인에 에러 핸들러 추가 (#397)
- Loading branch information
Showing
34 changed files
with
597 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
dependencies { | ||
implementation project(':auth:auth-application') | ||
|
||
implementation project(':core:exception-handler') | ||
|
||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
} |
17 changes: 17 additions & 0 deletions
17
auth/auth-interceptor/src/main/java/me/nalab/auth/interceptor/AuthExceptionAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package me.nalab.auth.interceptor; | ||
|
||
import me.nalab.core.exception.handler.ErrorTemplate; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@RestControllerAdvice | ||
public class AuthExceptionAdvice { | ||
|
||
@ExceptionHandler(CannotValidTokenException.class) | ||
@ResponseStatus(HttpStatus.UNAUTHORIZED) | ||
public ErrorTemplate handleCannotValidTokenException(CannotValidTokenException exception) { | ||
return ErrorTemplate.of(exception.getMessage()); | ||
} | ||
} |
4 changes: 0 additions & 4 deletions
4
...th-interceptor/src/main/java/me/nalab/auth/interceptor/CannotValidMockTokenException.java
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
auth/auth-interceptor/src/main/java/me/nalab/auth/interceptor/CannotValidTokenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package me.nalab.auth.interceptor; | ||
|
||
public class CannotValidTokenException extends RuntimeException { | ||
|
||
public CannotValidTokenException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
POST http://nalab-server:8080/v1/oauth/default # Default provider를 통해서 로그인 진행 | ||
{ | ||
"nickname": "cancel_bookmark_survey", | ||
"email": "cancel_bookmark_survey@123456" | ||
} | ||
|
||
HTTP 200 | ||
[Asserts] | ||
header "Content-type" == "application/json" | ||
|
||
jsonpath "$.access_token" exists | ||
jsonpath "$.token_type" exists | ||
|
||
[Captures] | ||
token_type: jsonpath "$.token_type" | ||
auth_token: jsonpath "$.access_token" | ||
|
||
########## | ||
|
||
POST http://nalab-server:8080/v1/surveys # 발급받은 토큰으로 survey를 생성한다. | ||
Authorization: {{ token_type }} {{ auth_token }} | ||
{ | ||
"question_count": 2, | ||
"question": [ | ||
{ | ||
"type": "choice", | ||
"form_type": "tendency", | ||
"title": "저는 UI, UI, GUI 중에 어떤 분야를 가장 잘하는 것 같나요?", | ||
"choices": [ | ||
{ | ||
"content": "UI", | ||
"order": 1 | ||
}, | ||
{ | ||
"content": "UX", | ||
"order": 2 | ||
}, | ||
{ | ||
"content": "GUI", | ||
"order": 3 | ||
} | ||
], | ||
"max_selectable_count": 1, | ||
"order": 1 | ||
}, | ||
{ | ||
"type": "short", | ||
"form_type": "strength", | ||
"title": "저는 UX, UI, GUI 중에 어떤 분야에 더 강점이 있나요?", | ||
"order": 2 | ||
} | ||
] | ||
} | ||
|
||
HTTP 201 | ||
[Asserts] | ||
header "Content-type" == "application/json" | ||
|
||
jsonpath "$.survey_id" exists | ||
|
||
[Captures] | ||
survey_id: jsonpath "$.survey_id" | ||
|
||
########## | ||
|
||
GET http://nalab-server:8080/v1/surveys/{{ survey_id }} # 생성된 survey를 조회한다. | ||
|
||
HTTP 200 | ||
[Asserts] | ||
header "Content-type" == "application/json" | ||
|
||
jsonpath "$.survey_id" exists | ||
|
||
jsonpath "$.target.id" exists | ||
jsonpath "$.target.nickname" == "cancel_bookmark_survey" | ||
|
||
jsonpath "$.question_count" == 2 | ||
jsonpath "$.question.[0].question_id" exists | ||
jsonpath "$.question.[0].type" == "choice" | ||
jsonpath "$.question.[0].form_type" == "tendency" | ||
jsonpath "$.question.[0].title" == "저는 UI, UI, GUI 중에 어떤 분야를 가장 잘하는 것 같나요?" | ||
jsonpath "$.question.[0].order" == 1 | ||
jsonpath "$.question.[0].max_selectable_count" == 1 | ||
jsonpath "$.question.[0].choices.[0].choice_id" exists | ||
jsonpath "$.question.[0].choices.[0].content" == "UI" | ||
jsonpath "$.question.[0].choices.[0].order" == 1 | ||
jsonpath "$.question.[0].choices.[1].choice_id" exists | ||
jsonpath "$.question.[0].choices.[1].content" == "UX" | ||
jsonpath "$.question.[0].choices.[1].order" == 2 | ||
jsonpath "$.question.[0].choices.[2].choice_id" exists | ||
jsonpath "$.question.[0].choices.[2].content" == "GUI" | ||
jsonpath "$.question.[0].choices.[2].order" == 3 | ||
jsonpath "$.question.[1].question_id" exists | ||
jsonpath "$.question.[1].type" == "short" | ||
jsonpath "$.question.[1].form_type" == "strength" | ||
jsonpath "$.question.[1].title" == "저는 UX, UI, GUI 중에 어떤 분야에 더 강점이 있나요?" | ||
jsonpath "$.question.[1].order" == 2 | ||
|
||
[Captures] | ||
target_id: jsonpath "$.target.id" | ||
|
||
########## | ||
|
||
POST http://nalab-server:8080/v1/surveys/{{ survey_id }}/bookmarks | ||
Authorization: {{ token_type }} {{ auth_token }} | ||
|
||
HTTP 200 | ||
[Asserts] | ||
|
||
########## | ||
|
||
POST http://nalab-server:8080/v1/surveys/{{ survey_id }}/bookmarks/cancels | ||
Authorization: {{ token_type }} {{ auth_token }} | ||
|
||
HTTP 200 | ||
[Asserts] |
Oops, something went wrong.