1

I have some RESTful web services that require Kerberos authentication. 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 . Also its using SPENEGO in background( when trying to hit the rest web service using curl.)

Thanks

Kini
  • 21
  • 1
  • 5
  • FYI, Kerberos auth on HTTP is (almost) always done through SPNEGO. – Samson Scharfrichter May 09 '17 at 18:32
  • Thank you Samson .how do we use kerberos authentication using rest assured to make a rest call – Kini May 10 '17 at 11:22
  • Why don't you just search the documentation of your HTTP client library for keyword `SPNEGO`? – Samson Scharfrichter May 10 '17 at 12:08
  • 1
    If you really want to know how the "negotiation" works, look at that comment http://stackoverflow.com/questions/41959970/kerberos-authentification#comment71105525_41959970 >> but be aware that Windows versions of `curl` use SSPI (the Microsoft implementation of Kerberos) and things are a bit different. – Samson Scharfrichter May 10 '17 at 12:10

1 Answers1

0

for following curl command kinit was done for the principal

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

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()
Meena Rajani
  • 143
  • 1
  • 7