Skip to content

Commit

Permalink
feat: Add swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
SeoYoonJu committed Mar 25, 2024
1 parent b9e1588 commit 2a71907
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
1 change: 0 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions JWT/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ dependencies {
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.2'

// Swagger
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'io.springfox:springfox-swagger-ui:3.0.0'
// implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'


Expand Down
34 changes: 34 additions & 0 deletions JWT/src/main/java/JWTLogIn/JWT/Swagger/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package JWTLogIn.JWT.Swagger.config;


import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

@OpenAPIDefinition(
info = @Info(title = "tg-wing 홈페이지",
description = "다들 아자아자 화이팅^^",
version = "v1"))
@Configuration
public class SwaggerConfig {

@Bean
public OpenAPI openAPI(){
SecurityScheme securityScheme = new SecurityScheme()
.type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")
.in(SecurityScheme.In.HEADER).name("Authorization");
SecurityRequirement securityRequirement = new SecurityRequirement().addList("bearerAuth");

return new OpenAPI()
.components(new Components().addSecuritySchemes("bearerAuth", securityScheme))
.security(Arrays.asList(securityRequirement));
}

}

0 comments on commit 2a71907

Please sign in to comment.