将以下curl命令转换为等效的java代码
我正在尝试使用centrifyapi 以下curl命令可以正常工作将以下curl命令转换为等效的java代码,java,curl,cookies,httpclient,centrify,Java,Curl,Cookies,Httpclient,Centrify,我正在尝试使用centrifyapi 以下curl命令可以正常工作 curl -H "X-CENTRIFY-NATIVE-CLIENT:1" -H "Content-type: application/json" -d "{User: '*****,Version: '1.0', TenantId: '' }" 'https://****.cellwe.samsungknox.com/Security/StartAuthentication' --dump-header
curl -H "X-CENTRIFY-NATIVE-CLIENT:1" -H "Content-type: application/json" -d "{User: '*****,Version: '1.0', TenantId: '' }" 'https://****.cellwe.samsungknox.com/Security/StartAuthentication' --dump-header headers.txt
curl -H "X-CENTRIFY-NATIVE-CLIENT:1" -H "Content-type: application/json" -d "{TenantId: '***', SessionId: 'qyrOp_Dvg-btRLQRtjzS2n1AeE2s3tpDh1V68A3TM8Y1', MechanismId: 'tKrhMSCSkUCGzPj2C1aTg1fFrWc75XY-BOhuu63qa9k1',Action: 'Answer', Answer: '****'}" 'https://****.cellwe.samsungknox.com/security/AdvanceAuthentication' --dump-header headers.txt
curl -H "X-CENTRIFY-NATIVE-CLIENT:1" -H "Content-type: application/json" -d "{UUID:'*****'}" -b headers.txt 'https://****.cellwe.samsungknox.com/UserMgmt/GetUserInfo'
我无法编写等效的java代码,因为有些cookie不是通过请求传输的
请参考以下API指南以及.net中的示例程序
API指南
示例程序
在连接到URL之前,您可以使用添加cookie。使用具有相同参数的
Apache HTTP Client
如何?此外,您不必将获取的身份验证令牌作为cookie发送回去,您可以将其作为oauth承载令牌(在标头中)发送,您可以使用,在连接到URL之前。使用具有相同参数的Apache HTTP Client
怎么样?注意,您不必将获取的身份验证令牌作为cookie发送回去,您可以将其作为oauth承载令牌(在标头中)发送