See already implemented JIra
Support secure proxy user access to HiveServer2
That fix expects the hive.server2.proxy.user parameter to come in Thrift body.
When an intermediary gateway like Apache Knox is authenticating the end client and then proxying the request to HiveServer2, it is not practical for the intermediary like Apache Knox to modify thrift content.
Intermediary like Apache Knox should be able to assert doAs in a query parameter. This paradigm is already established by other Hadoop ecosystem components like WebHDFS, WebHCat, Oozie and HBase and Hive needs to be aligned with them.
The doAs asserted in query parameter should override if doAs specified in Thrift body.