Skip to content

Commit

Permalink
feat(bpdm-cert): updated application version with enabling feature of…
Browse files Browse the repository at this point in the history
… open id scheme
  • Loading branch information
SujitMBRDI committed Jan 9, 2024
1 parent db07590 commit 447020f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<groupId>org.eclipse.tractusx</groupId>
<artifactId>bpdm-certificate-management</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
<name>bpdm-certificate-management</name>
<description>bpdm-certificate-management</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ package org.eclipse.tractusx.bpdmcertificatemanagement.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 io.swagger.v3.oas.models.security.*
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

Expand All @@ -42,27 +41,27 @@ class OpenApiConfiguration (
private fun OpenAPI.withSecurity(): OpenAPI {
return this.components(
Components()
// .addSecuritySchemes(
// "open_id_scheme",
// SecurityScheme().type(SecurityScheme.Type.OAUTH2).flows(
// OAuthFlows().authorizationCode(
// OAuthFlow().authorizationUrl(securityProperties.authUrl)
// .tokenUrl(securityProperties.tokenUrl)
// .refreshUrl(securityProperties.refreshUrl)
// .scopes(Scopes())
// ).clientCredentials(
// OAuthFlow().tokenUrl(securityProperties.tokenUrl)
// )
// )
// )
.addSecuritySchemes(
"open_id_scheme",
SecurityScheme().type(SecurityScheme.Type.OAUTH2).flows(
OAuthFlows().authorizationCode(
OAuthFlow().authorizationUrl(securityProperties.authUrl)
.tokenUrl(securityProperties.tokenUrl)
.refreshUrl(securityProperties.refreshUrl)
.scopes(Scopes())
).clientCredentials(
OAuthFlow().tokenUrl(securityProperties.tokenUrl)
)
)
)
.addSecuritySchemes(
"bearer_scheme",
SecurityScheme().type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")
)
)
//.addSecurityItem(SecurityRequirement().addList("open_id_scheme", emptyList()))
.addSecurityItem(SecurityRequirement().addList("open_id_scheme", emptyList()))
.addSecurityItem(SecurityRequirement().addList("bearer_scheme", emptyList()))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface MetadataApi {
description = "Get a list of all currently registered certificate types.",
responses = [
ApiResponse(responseCode = "200", description = "List of registered certificate types, or can be empty"),
ApiResponse(responseCode = "400", description = "Malformed URL")
ApiResponse(responseCode = "400", description = "Malformed URL", content = [Content()])
]
)
@GetMapping("/certificate-types")
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ bpdm-cert:
name: "BPDM Certificate Management"
description: "Service that manages and shares business partner certificates"
version: "0.0.1"

datasource:
host: localhost
security:
enabled: false

Expand All @@ -43,7 +44,7 @@ spring:
datasource:
driverClassName: org.postgresql.Driver
password: ''
url: jdbc:postgresql://localhost:5432/bpdm_certificates
url: jdbc:postgresql://${bpdm-cert.datasource.host}:5432/bpdm_certificates
username: bpdm_certificates
# Flyway configuration
flyway:
Expand Down

0 comments on commit 447020f

Please sign in to comment.