Swagger UI URL's in Keycloak 18 is not working after upgrade from keycloak 3 to keycloak 18 using keycloak policies/permissions

I have a Keycloak protected integraion/Rest API that I would like to access via swagger-UI. Keycloak provides the faciltiy to use policy and permission for different users, but I am not able to make it work. Earlier it was working in keycloak 3 but now we are facing issue with the same code after upgrading to keycloak 18 .

Please help me on this issue. What needs to be corrected as per keycloak 18 in my code.