Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amruta #90

Open
springamruta opened this issue Jun 8, 2021 · 0 comments
Open

Amruta #90

springamruta opened this issue Jun 8, 2021 · 0 comments

Comments

@springamruta
Copy link

springamruta commented Jun 8, 2021

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") })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant