Skip to content

Amruta #90

Open
Open
@springamruta

Description

@springamruta

I am using Swagger OpenAPI 3 with Spring boot and OAuth2.0. I have following configuration for swagger
@OpenAPIDefinition(info = @Info(title = "REST API Documentation", version = "V1", description = "REST API Documentation"), servers = { @Server(url = "https://localhost:8080/api", description = "Test") } @SecurityScheme(name = "security_auth", type = SecuritySchemeType.OAUTH2, in = SecuritySchemeIn.HEADER, bearerFormat = "jwt", flows = @OAuthFlows(authorizationCode = @OAuthFlow(authorizationUrl = "${oAuthFlow.authorizationUrl}", tokenUrl = "${oAuthFlow.tokenUrl}", scopes = { @OAuthScope(name = "read", description = "read scope") }))) public class OpenApiConfig { }
Identity server is being used for authentication. Identity server expects the redirect URL to be 'https' but the redirect URL generated by swagger is 'http' ("https://localhost:8080/api/swagger-ui/oauth2-redirect.html") and hence fails to authenticate. I see that swagger is forming the URL with window.location.protol

I tried setting server variable in configuration which did not work
@Server(url = "https://localhost:8080/api", description = "Test", variables = { @ServerVariable(defaultValue = "protocol", name = "https") })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions