Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

OSLC API as power BI source (RM data)

 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

0 votes



2 answers

Permanent link

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}"

1 vote


Permanent link

 You could also use the eclipse/Lyo Java client.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Nov 12 '19, 11:54 p.m.

Question was seen: 1,779 times

Last updated: Nov 13 '19, 7:35 a.m.

Confirmation Cancel Confirm