Skip to content

Commit

Permalink
[HOTFIX] validate token api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jinjoo-lab committed Sep 26, 2023
1 parent 0f4e170 commit 2e16a43
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
"/v3/api-docs/**",
"/swagger-ui/**",
"/swagger-ui.html",
"auth/**")
"auth/refresh")
.permitAll())
.authorizeHttpRequests(
x -> x.requestMatchers("/test/**").permitAll().anyRequest().authenticated())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
Expand Down Expand Up @@ -34,6 +35,25 @@
class AuthControllerTest extends RestDocsTest {
@MockBean private AuthService authService;

@Test
@DisplayName("토큰이 만료되었는가")
void validate() throws Exception {

// when
final ResultActions perform =
mockMvc.perform(
get("/auth/validate")
.contentType(MediaType.APPLICATION_JSON)
.header("Authorization",
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));
// then
perform.andExpect(status().isNoContent());
//docs

perform.andDo(print())
.andDo(document("토큰 유효성 검사 성공", getDocumentRequest(), getDocumentResponse()));
}

@Test
@DisplayName("JWT 리프레시 API가 수행되는가")
void authorize() throws Exception {
Expand Down

0 comments on commit 2e16a43

Please sign in to comment.