Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

python api Cloudera Manager login issue in SAML external authencation

avatar
Explorer

Team,

 

I have configured SAML authenation for cloudera manager/hue/navigator and i am able to login via respective Web UI. however when i connect though python api, i am getting below exception.

 

Please note that, i have enabled Settings - Cloudera Manager

Database then External
 
Traceback (most recent call last):
File "ssl-update_cm_connect.py", line 17, in <module>
clu=api.get_cluster('Cluster 1')
File "/anaconda2/lib/python2.7/site-packages/cm_api/api_client.py", line 140, in get_cluster
return clusters.get_cluster(self, name)
File "anaconda2/lib/python2.7/site-packages/cm_api/endpoints/clusters.py", line 57, in get_cluster
return call(resource_root.get, "%s/%s" % (CLUSTERS_PATH, name), ApiCluster)
File "/anaconda2/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 139, in call
ret = method(path, params=params)
File "//anaconda2/lib/python2.7/site-packages/cm_api/resource.py", line 110, in get
return self.invoke("GET", relpath, params)
File "/anaconda2/lib/python2.7/site-packages/cm_api/resource.py", line 73, in invoke
headers=headers)
File "/anaconda2/lib/python2.7/site-packages/cm_api/http_client.py", line 183, in execute
raise self._exc_class(ex)
cm_api.api_client.ApiException: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 401 Full authentication is required to access this resource</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /api/v12/clusters/Cluster%201. Reason:
<pre> Full authentication is required to access this resource</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
---------------------------------------------------------------
python code
---------------------------------------------------------------
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
api = ApiResource(CM_HOST,version=12, username="admin", password="admin",ssl_context=context)
1 ACCEPTED SOLUTION

avatar
Explorer

ignore my post. i was able to fix above issue by creating correct ssl context

 

context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
cxt = ssl.create_default_context(cafile="/opt/pki/etc/tca/ca_cs_combined.pem")

 

View solution in original post

1 REPLY 1

avatar
Explorer

ignore my post. i was able to fix above issue by creating correct ssl context

 

context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
cxt = ssl.create_default_context(cafile="/opt/pki/etc/tca/ca_cs_combined.pem")