It's all about the answers!

Ask a question

OSLC API as power BI source (RM data)


Tom Watkins (111) | asked Nov 12 '19, 11:54 p.m.

 Hi all


I have been trying to use the OSLC API as a data source to hook requirements data into power BI. Trying to use the web data source however it is getting stuck at the DOORS NG login page.

Does anyone have experience here?

Thanks

2 answers



permanent link
Jim Amsden (29347) | answered Nov 13 '19, 7:32 a.m.

Here's some Python code that demonstrates how to login using OpenIDConnect and JEE Forms. You should be able to adapt this to your needs.

 
class EWMClient:
    def init(self, server_url, user, password):
        self.base_url = server_url
        self.userid = user
        self.password = password
        
        # Disable SSL so that we can read self-assigned certificates
        self.http = httplib2.Http(".cache", disable_ssl_certificate_validation=True)
        self.http.follow_redirects = True
        self.headers = {'Content-type': 'application/rdf+xml'}
        protectedResource = "/whoami"
       
        # Create an authentication challenge by attempting to access a protected resource
        resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)
        if (resp.status == 404):
            # the JRS server does not support whoami
            protectedResource = ''
            resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)

            
        if ('x-com-ibm-team-repository-web-auth-msg' in resp and resp['x-com-ibm-team-repository-web-auth-msg'] == 'authrequired'):
            # JEE Forms authentication
            resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)
            self.headers['Cookie'] = resp['set-cookie'] 
            self.headers['Content-type'] = 'application/x-www-form-urlencoded'
          
            # now we can start the authentication via j_security_check page
            resp, content = self.http.request(self.base_url+'/j_security_check' , 'POST', headers=self.headers, 
                        body=urllib.parse.urlencode({'j_username': user, 'j_password': password}))
            # Successful login will set the LtpaToken2 required for subsequent authenticated access
            self.headers['Cookie'] = resp['set-cookie']
        else:
            # Try sending the credentials for OpenIDConnect
            self.http.add_credentials(user, password)
                         
        # check authentication was successful, if not throw exception
        resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)
        assert (resp.status == 200), f"Login failed with status: {resp.status}"


permanent link
Jim Amsden (29347) | answered Nov 13 '19, 7:35 a.m.

 You could also use the eclipse/Lyo Java client.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.