springdoc-openapi-ui get rid of "client_secret"

Viewed 519
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.5.8</version>
        </dependency>

what in general works well.

But when i open: http://localhost:8441/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config the oAuth login gui always shows a not expected "client_secret": enter image description here

I already tried the "usePkceWithAuthorizationCodeGrant" option

springdoc:
  version: '@springdoc.version@'
  swagger-ui:
    path: /swagger-ui.html
    url: /v3/api-docs
    oauth:
      clientId: ${OAUTH_CLIENT_ID:client-demo-test}
      usePkceWithAuthorizationCodeGrant: true
      additionalQueryStringParams:
        kc_idp_hint: azure_demo_prod

How can this field be hidden?

The open api config:

@Configuration
public class OpenApiConfig {
    private final String authServer;
    private final String realm;

    @Autowired
    public OpenApiConfig(
            @Value("${springdoc.oAuthFlow.authServerUrl}") String authServer,
            @Value("${springdoc.oAuthFlow.realm}") String realm) {
        this.authServer = authServer;
        this.realm = realm;
    }

    @Bean
    public OpenAPI openAPI() {
        var authUrl = String.format("%s/realms/%s/protocol/openid-connect", authServer, realm);
        return new OpenAPI()
                .components(new Components()
                        .addSecuritySchemes("spring_oauth", new SecurityScheme()
                                .type(SecurityScheme.Type.OAUTH2)
                                .description("Oauth2 flow")
                                .flows(new OAuthFlows()
                                        .authorizationCode(new OAuthFlow()
                                                .authorizationUrl(authUrl + "/auth")
                                                .refreshUrl(authUrl + "/token")
                                                .tokenUrl(authUrl + "/token")
                                                .scopes(new Scopes()
                                                        .addString("openid", null)
                                                        .addString("profile", null)
                                                        .addString("email", null)
                                                        .addString("offline_access", null)
                                                        .addString("sbbuid_ad", null)
                                                )
                                        )))
                )
                .security(Arrays.asList(
                        new SecurityRequirement().addList("spring_oauth")
                ))

                .info(new Info()
                        .title("CLEW-SSP")
                        .description("Your API")
                        .version("1.0.0")
                        .license(new License()
                                .name("MIT")
                                .url("https://opensource.org/licenses/MIT")
                        )
                );
    }

}
0 Answers
Related