在api界面上可以直接填写jwt的token
This commit is contained in:
parent
831c87ce0f
commit
19d7f3e74a
35
src/main/java/com/lk/paopao/conf/SwaggerConfig.java
Normal file
35
src/main/java/com/lk/paopao/conf/SwaggerConfig.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package com.lk.paopao.conf;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI customize() {
|
||||||
|
Components components = new Components();
|
||||||
|
|
||||||
|
SecurityScheme scheme = new SecurityScheme()
|
||||||
|
.name("bearerAuth")
|
||||||
|
.type(SecurityScheme.Type.HTTP)
|
||||||
|
.scheme("bearer")
|
||||||
|
.bearerFormat("JWT");
|
||||||
|
|
||||||
|
components.addSecuritySchemes("bearerAuth", scheme);
|
||||||
|
|
||||||
|
return new OpenAPI().
|
||||||
|
components(components)
|
||||||
|
.addSecurityItem(new SecurityRequirement().addList("bearerAuth"))
|
||||||
|
.info(new Info()
|
||||||
|
.title("PaoPao API")
|
||||||
|
.description("PaoPao Restful API 接口测试")
|
||||||
|
.version("v1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user