Skip to content

Commit

Permalink
feat: adding header Authorization in swagger request http
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroVidalDev committed Jun 20, 2024
1 parent de5067c commit 56d7072
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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;
Expand All @@ -12,7 +14,12 @@ public class SpringDocConfig {
public OpenAPI customOpenAPI(){
return new OpenAPI()
.components(new Components()
.addSecuritySchemes("bearer-key",
new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")));
.addSecuritySchemes("Authorization", new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")))
.info(new Info().title("Sphynx API"))
.addSecurityItem(new SecurityRequirement().addList("Authorization"));
}
}

0 comments on commit 56d7072

Please sign in to comment.