简体   繁体   English

Kerberos身份验证使用放心

[英]Kerberos authentication using rest assured

I have some RESTful web services that require Kerberos authentication. 我有一些需要Kerberos身份验证的RESTful Web服务。 I would like to use REST Assured to test these services,is there any preferred way to perform Kerberos authentication using REST Assured?How do we do that . 我想使用REST Assured来测试这些服务,是否有任何使用REST Assured执行Kerberos身份验证的首选方法?我们如何做到这一点。 Also its using SPENEGO in background( when trying to hit the rest web service using curl.) 它也在背景中使用SPENEGO(当试图使用curl打击其余的Web服务时。)

Thanks 谢谢

for following curl command kinit was done for the principal 对于跟随curl命令,kinit已经为校长完成了

curl --negotiate -u : -H "X-Requested-By:ambari" -i -X GET http://hostnamefornamenode:50070/jmx?qry=Hadoop:service=NameNode,name=FSNamesystem

I used following code in python 我在python中使用了以下代码

import requests
from requests_kerberos import HTTPKerberosAuth
headers = {
    'X-Requested-By': 'ambari',
}
params = (
    ('qry', 'Hadoop:service=NameNode,name=FSNamesystem'),
)
res = requests.get('http://hostnamefornamenode:50070/jmx', headers=headers, params=params, auth=HTTPKerberosAuth())
print res.json()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM