Skip to content

Commit

Permalink
FKS-550 #comment enabled swagger with authentication, cleaning #done
Browse files Browse the repository at this point in the history
  • Loading branch information
Erling Jahr committed Dec 7, 2023
1 parent d6a1011 commit 0017434
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,21 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
//implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'

implementation 'io.netty:netty-resolver-dns-native-macos:4.1.82.Final:osx-aarch_64'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.flywaydb:flyway-core'
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'no.fintlabs:fint-kafka:3.0.0-rc-1'
implementation 'no.fintlabs:fint-antlr:1.1.1'
implementation 'no.fintlabs:fint-resource-server-security:1.1.0'
implementation 'no.fintlabs:fint-kontroll-authorization:1.1.6'
implementation 'no.fint:fint-model-resource:0.4.1'
implementation 'io.projectreactor:reactor-core'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'org.modelmapper:modelmapper:3.1.1'
implementation 'org.springdoc:springdoc-openapi-ui:1.6.15'
implementation 'org.springdoc:springdoc-openapi-security:1.6.15'


compileOnly 'org.projectlombok:lombok'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
Expand Down
34 changes: 31 additions & 3 deletions src/main/java/no/fintlabs/Application.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
package no.fintlabs;

import no.fint.antlr.EnableFintFilter;
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.info.License;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.context.annotation.Bean;

@EnableFintFilter
@ConfigurationPropertiesScan
@SpringBootApplication
public class Application {

public static void main(String[] args) {

SpringApplication.run(Application.class, args);
}

@Bean
public OpenAPI openAPIDescription() {
return new OpenAPI()
.info(new Info()
.title("FINT Kontroll user management")
.version("1.0.0")
.description("API's for retrieving user objects")
.termsOfService("http://swagger.io/terms/")
.license(new License().name("Apache 2.0").url("http://springdoc.org")))
.components(new Components()
.addSecuritySchemes("bearer-jwt", new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")
.in(SecurityScheme.In.HEADER)
.description("Auth key")
.name("Authorization"))
)
.addSecurityItem(new SecurityRequirement()
.addList("bearer-jwt"))
;
}

}

0 comments on commit 0017434

Please sign in to comment.