I want to add the x-tokenName extension to the openApi security scheme component in quarkus using the application.properties file. I’am using microsoft as provider for openIdConnect, and therefore i got a response containing an access_token and a id_token.
My configuration so far, look somehow like this:
quarkus.smallrye-openapi.security-scheme=oidc quarkus.smallrye-openapi.security-scheme-name=OpenId quarkus.smallrye-openapi.oidc-open-id-connect-url=https://login.microsoftonline.com/${TENANT_ID}/v2.0/.well-known/openid-configuration
The corresponding openapi.yaml looks for the security scheme part like this:
components: securitySchemes: OpenId: type: openIdConnect description: Authentication openIdConnectUrl: https://login.microsoftonline.com/xxxxxxxxxx/v2.0/.well-known/openid-configuration
I did not find any possibility, to add x-tokenName with properties like this (or similiar):
quarkus.smallrye-openapi.security-scheme-extension=tokenName:id_token
to achieve a corresponding openapi.yaml like this:
components: securitySchemes: OpenId: type: openIdConnect description: Authentication openIdConnectUrl: https://login.microsoftonline.com/xxxxxxxxxx/v2.0/.well-known/openid-configuration x-tokenName: id_token
As far as i know, these extension are part of openApi and should work. Or am I missing something?
Advertisement
Answer
Adding x-* to the security model is not possible with config (at the moment). But I think that would be a valid feature to request, so please do so in the issues.
What you can do for now is to create your own Filter (that is all that it is under the covers).
And the current filter in Quarkus: https://github.com/quarkusio/quarkus/blob/main/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/filter/SecurityConfigFilter.java