[Engine-devel] auth issue

Juan Hernandez juan.hernandez at redhat.com
Tue May 8 09:12:54 UTC 2012


On 05/08/2012 10:58 AM, Hui Kai Ran wrote:
> Hi, all
> 
> When I access the REST API like this
> ====================================
> import urllib2
> theurl = 'http://9.181.129.112:8080/api'
> username = 'admin at internal'
> password = 'abcd1234'
> # a great password
> 
> passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
> 
> passman.add_password('ENGINE', theurl, username, password)
> 
> authhandler = urllib2.HTTPBasicAuthHandler(passman)
> 
> opener = urllib2.build_opener(authhandler)
> 
> urllib2.install_opener(opener)
> pagehandle = urllib2.urlopen(theurl)
> =========================================
> urlopen failed.
> 
> then We do that another way like this, it is ok
> ========================================
> import urllib2
> import sys
> import re
> import base64
> import xml.etree.ElementTree as etree
> 
> username='admin at internal'
> password='abcd1234'
> 
> request = urllib2.Request("http://9.181.129.112:8080/api")
> base64string = base64.encodestring('%s:%s' % (username, 
> password)).replace('\n', '')
> request.add_header("Authorization", "Basic %s" % base64string)
> result = urllib2.urlopen(request)
> 
> by catching the packets transfered, we found the response from 
> ovirt-engine server as below for failing case:
> ================================================================
> GET /api HTTP/1.1
> Accept-Encoding: identity
> Host: 9.181.129.112:8080
> Connection: close
> User-Agent: Python-urllib/2.7
> 
> HTTP/1.1 401 Unauthorized
> Server: Apache-Coyote/1.1
> WWW-Authenticate: Basic realm = "ENGINE"
> Content-Type: text/html;charset=utf-8
> Content-Length: 956
> Date: Fri, 04 May 2012 09:18:06 GMT
> Connection: close
> 
> Is there anything wrong for oVirt-engine?

Yes, this is a known issue that has been recently fixed:

http://gerrit.ovirt.org/3925



More information about the Engine-devel mailing list