I've enabled the Swagger open API 3.0 like below:
Added following dependencies
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>
After that added below bean for customization.
@Bean
public OpenAPI customOpenAPI(@Value("${application-description}") String appDesciption,
@Value("${application-version}") String appVersion) {
return new OpenAPI().info(new Info().title("One Money Backend API").version(appVersion)
.description(appDesciption).termsOfService("http://swagger.io/terms/")
.license(new License().name("Apache 2.0").url("http://springdoc.org")));
}
All is working fine. I'm able to access swagger-ui and api-docs.
But I've few api's which is secured with keycloak OAuth 2.0. When I'm trying to access those secured api's I'm getting unauthorized error (it is expected). I want to test secured api's as well from swagger open api 3.0.
Can some one please help me to enable authorization in swagger open api 3.0 to test my secured api's from swagger.