All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.octopusden.employee.config.OpenApiConfig.kt Maven / Gradle / Ivy

The newest version!
package org.octopusden.employee.config

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
class OpenApiConfig {

    @Bean
    fun springShopOpenAPI(): OpenAPI {
        val securitySchemeName = "bearerAuth"
        return OpenAPI().info(Info().title("Employee Service").description("Employee Service API"))
            .addSecurityItem(SecurityRequirement().addList(securitySchemeName)).components(
                Components().addSecuritySchemes(
                    securitySchemeName,
                    SecurityScheme().name(securitySchemeName).type(SecurityScheme.Type.HTTP).scheme("bearer")
                        .bearerFormat("JWT")
                )
            )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy