[keycloak-user] Keycloak, SpringBoot, and Swagger-UI

Ali Ahmadzadeh Asl ahmadzadehasl at outlook.com
Sat Jun 1 06:28:09 EDT 2019


Hi,

Can anybody help to resolve this problem?

________________________________
From: keycloak-user-bounces at lists.jboss.org <keycloak-user-bounces at lists.jboss.org> on behalf of Ali Ahmadzadeh Asl <ahmadzadehasl at outlook.com>
Sent: Tuesday, May 21, 2019 5:23 PM
To: keycloak-user at lists.jboss.org
Subject: [keycloak-user] Keycloak, SpringBoot, and Swagger-UI

Hi Dears

I have a Spring Boot project which uses Swagger-UI library for describing and testing REST services. Everything was ok until I added Keycloak library and settings to my project. The Keycloak settings are:

keycloak.realm=my-realm
keycloak.resource=my-app
keycloak.ssl-required=external
keycloak.enable-basic-auth=true
keycloak.autodetect-bearer-only=true
keycloak.use-resource-role-mappings=true
keycloak.principal-attribute=preferred_username
keycloak.auth-server-url=http://localhost:8080/auth
keycloak.credentials.secret=f3776b88-2600-44fa-83ec-67cb72fa0000
keycloak.policy-enforcer-config.on-deny-redirect-to=/access-denied

keycloak.securityConstraints[0].authRoles[0] = USER
keycloak.securityConstraints[0].securityCollections[0].name = default
keycloak.securityConstraints[0].securityCollections[0].patterns[0] = /*

Now, when a logged in user wants to see Swagger-UI page using a URL like http://127.0.0.1:6060/swagger-ui.html, a message containing bellow text and a text box shown:

"Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually: "

But the JSON of services' definitions is accessible from http://127.0.0.1:6060/v2/api-docs address.

Can anybody help me to solve this problem? What is the reason for this matter? How can I resolve?

Thanks


More information about the keycloak-user mailing list