App engine P12 AccessControlException

心不动则不痛 提交于 2019-12-24 12:33:43

问题


I am trying to read a P12 key on App Engine ( Google ) They key is located in WEB-INF directory.

Currently I have this code :

Credential credential = new GoogleCredential.Builder()
                .setTransport(httpTransport)
                .setJsonFactory(jsonFactory)
                .setServiceAccountId(ACCOUNT_ID_PROPERTY)
                .setServiceAccountPrivateKeyFromP12File(
                        new File("/WEB-INF/key.p12"))
                .setServiceAccountScopes(scopes).build();

But it's returning me this error :

java.security.AccessControlException: access denied ("java.io.FilePermission" "\WEB-INF\key.p12" "read")

Any idea's to fix this ?

Thanks !


回答1:


Please remove the forward slash from the path. Provide new File("WEB-INF/key.p12") and it should get through.



来源:https://stackoverflow.com/questions/22002782/app-engine-p12-accesscontrolexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!