Skip to content

Commit

Permalink
feat : member, admin 부분 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
0702Yoon committed Oct 2, 2024
1 parent f510784 commit 2a62626
Showing 1 changed file with 46 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,36 @@ public class SwaggerConfig {
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.info(new Info().title("My API")
.version("1.0")
.description("My API Description"))
.servers(List.of(
new Server().url(DOMAIN_URL) // HTTPS로 설정
.description("Production server")
))
.components(new Components()
.addSecuritySchemes("Authorization", new SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.in(SecurityScheme.In.HEADER)
.name("Authorization")
))
.addSecurityItem(new SecurityRequirement().addList("Authorization"));
.info(apiInfo())
.servers(httpsServer())
.components(createComponents())
.addSecurityItem(createSecurityRequirement());
}

private static SecurityRequirement createSecurityRequirement() {
return new SecurityRequirement().addList("Authorization");
}

private static Components createComponents() {
return new Components()
.addSecuritySchemes("Authorization", new SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.in(SecurityScheme.In.HEADER)
.name("Authorization")
);
}

private static List<Server> httpsServer() {
return List.of(
new Server().url(DOMAIN_URL) // HTTPS로 설정
.description("Production server")
);
}

private static Info apiInfo() {
return new Info().title("My API")
.version("1.0")
.description("My API Description");
}

@Bean
Expand All @@ -43,4 +59,20 @@ public GroupedOpenApi publicApi() {
.build();
}

@Bean
public GroupedOpenApi memberApi() {
return GroupedOpenApi.builder()
.group("멤버 API")
.pathsToMatch("/api/v1/members/**") // 멤버 관련 엔드포인트만 포함
.build();
}

@Bean
public GroupedOpenApi adminApi() {
return GroupedOpenApi.builder()
.group("어드민 API")
.pathsToMatch("/api/v1/admin/**") // 관리자 관련 엔드포인트만 포함
.build();
}

}

0 comments on commit 2a62626

Please sign in to comment.