cancel
Showing results for 
Search instead for 
Did you mean: 

Commerce 2211 Swagger upgrade missing SecuritySchemes

swollmershaeuser
Explorer
0 Kudos
593

Hello,

we currently upgraded from 2205 to 2211 and so we had to update Swagger to OpenAPI 3.0.

So I did everything from this docu: https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/bbcd2978537e4ae298479557c0b8fdbd/6ea963ccf...

Everything seems to work except for the "Authorize"-Button

The popup is just empty.

Api-Docs-Response:

{
	"openapi": "3.0.1",
	"info": {
		"title": "",
		"description": "",
		"license": {
			"name": "",
			"url": ""
		},
		"version": ""
	},
	"externalDocs": {
		"description": "SAP Commerce Cloud",
		"url": "https://www.sap.com"
	},
	"servers": [
		{
			"url": "https://localhost:9002/rufwebservices/v2",
			"description": "Generated server url"
		}
	],
	"security": [
		{
			"oauth2_Password": [
				""
			]
		},
		{
			"oauth2_client_credentials": [
				""
			]
		}
	],
	"tags": [
		"..."
	],
	"paths": {
		"...": "..."
	},
	"components": {
		"schemas": {
			"...": "..."
		},
		"securitySchemes": {
			"oauth2_Password": {
				"type": "oauth2",
				"flows": {}
			},
			"oauth2_client_credentials": {
				"type": "oauth2",
				"flows": {}
			}
		}
	}
}

Code:

swagger.properties

spring.mvc.servlet.path = /v2
springdoc.swagger-ui.enabled = true

rufwebservices.v2.api.description = These services manage all the common commerce functionality, and also include customizations from installed AddOns. The implementing extension is called rufwebservices.
rufwebservices.v2.api.title = Commerce Webservices
rufwebservices.v2.api.version = 2.0
rufwebservices.v2.api.license = Use of this file is subject to the terms of your agreement with SAP SE or its affiliates respecting the use of the SAP product for which this file relates.
rufwebservices.v2.api.license.url =
rufwebservices.v2.api.oauth.password.scope = basic
rufwebservices.v2.api.oauth.clientCredentials.scope = extended
rufwebservices.v2.api.oauth.tokenUrl = /authorizationserver/oauth/token
rufwebservices.v2.sap.apiType = REST
rufwebservices.v2.sap.shortText = Enables you to manage all the common commerce functionality.
rufwebservices.v2.sap.state = Active
rufwebservices.v2.sap.servers = default
rufwebservices.v2.sap.server.default.url = https://{url}/rest/v2
rufwebservices.v2.sap.server.default.description = Commerce Webservices v2 REST API endpoint
rufwebservices.v2.sap.server.default.templates.url.description = SAP Commerce Cloud server URL where the application is deployed.

WebConfig.java

@Configuration
@ImportResource({"WEB-INF/config/v2/springmvc-v2-servlet.xml"})
public class WebConfig extends DelegatingWebMvcConfiguration {

...

CommerceSwaggerConfig

@Configuration
@PropertySource("WEB-INF/config/v2/swagger.properties")
@ImportResource(value = "classpath*:/swagger/swaggerintegration/web/spring/*-web-spring.xml")
public class CommerceSwaggerConfig {

    @Bean("apiDocInfo")
    public ApiDocInfo apiDocInfo() {
        return () -> "rufwebservices.v2";
    }
}

What am I missing? Where are the SecuritySchemes added (if they are really the problem)?

Accepted Solutions (0)

Answers (0)