I am using RequestAuthentication with my internal JWT to authenticate the requests. I also have some endpoints in my micro service system which need to be exposed without authentication, for this reason, I included an AuthorizationPolicy to allow the access without a valid token.
Having this working just fine, I now need to include specific AuthorizationPolicies for each micro service, so I can properly include SCOPES in my JWT and only allow access for specific users.
The main problem is that, I am able to access the specific endpoint when only using the to a specific method, but I always get RBAC: access denied when including the from and/or when.
A quick sanity check, did you specify the correct format for the requestPrincipals field? The format is combining the iss and sub with a / separator, e.g. some-issuer/some-subject
Hello YangminZhu, I even tried without the requestPrincipals field, removing the whole from block and only applying the when to ensure that it was correct.
I did though tested with the separator, having my_company/my_company as the documentation shows.
Okay then it’s better to get some more logging to help the troubleshooting.
Could you get the following:
the Envoy config dump of the my-microservice-service workload (you can use istioctl d envoy <pod.namespace> to open the debug page and copy the envoy_config there) and;
the Envoy debug logging of the my-microservice-service workload when you’re seeing the RBAC: access denied (you can turn on the debug logging by istioctl pc log <pod.namespace> --level "rbac:debug,jwt:debug"