-
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.
- Loading branch information
1 parent
e9cb896
commit 244ec90
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
kbazaar/src/main/java/com/kampus/kbazaar/swagger/SwaggerConfig.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,30 @@ | ||
package com.kampus.kbazaar.swagger; | ||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
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; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
private SecurityScheme createAPIKeyScheme() { | ||
return new SecurityScheme() | ||
.type(SecurityScheme.Type.HTTP) | ||
.bearerFormat("JWT") | ||
.scheme("bearer"); | ||
} | ||
|
||
@Bean | ||
public OpenAPI openAPI() { | ||
return new OpenAPI() | ||
.addSecurityItem(new SecurityRequirement().addList("Bearer Authentication")) | ||
.components( | ||
new Components() | ||
.addSecuritySchemes("Bearer Authentication", createAPIKeyScheme())) | ||
.info(new Info().title("KBazaar")); | ||
} | ||
} |