Closed EdouarL closed 3 years ago
Hi team,
I was stuck because for unknow reason cam_passport is not return. Here what I had
[
{
'domain': 'sub.domain.com',
'httpOnly': False,
'name': 'usersessionid',
'path': '/bi',
'secure': False,
'value': 'AggAAAD96qtfAAAAAAoAAACdxQF/nck+xD+LFAAAABpQ0lFc1cNrzvrPMIDIJGmxkYbfBwAAAFNIQS0yNTYgAAAAski3zI/7W5b/HBJN6qNgIPdg3vSUB2p+8BwSDFixh10='
},
{
'domain': 'sub.domain.com',
'httpOnly': False,
'name': 'TS_PSWD',
'path': '/bi',
'secure': False,
'value': 'myPassword'
},
{
'domain': 'sub.domain.com',
'httpOnly': False,
'name': 'TS_LOGIN',
'path': '/bi',
'secure': False,
'value': 'MyLogin'
},
{
'domain': 'sub.domain.com',
'httpOnly': False,
'name': 'MRUStorage',
'path': '/bi',
'secure': False,
'value': '%7B%22xZGVmaWhhYjp1OnVpZD1wdmdlMDY4MjEsb3U9dXNlcnM_%22%3Atrue%7D'
},
{
'domain': 'sub.domain.com',
'httpOnly': False,
'name': 'XSRF-TOKEN',
'path': '/bi',
'secure': False,
'value': '5j2px0HOQt8Blh8-kUIjGAnItphgCX1B'
}
]
After looking deeper into [https://github.com/cubewise-code/tm1py/issues/124] I finally found it very usefull. It is a nice workaround for the issue I raise. Due to specific authentification (LDAP + CJP) a custom TM1web.html file had been developp to send back cam_passport. So here the code I have use to change _build_authorization_token_cam function from [https://github.com/cubewise-code/tm1py/blob/master/TM1py/Services/RestService.py]
import time
import re
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--window-size=1920x1080")
chrome_options.add_argument("--ignore-certificate-error")
chrome_options.add_argument("--ignore-ssl-errors")
driver = webdriver.Chrome(options = chrome_options, executable_path = r'C:\temp\chromedriver_win32\chromedriver.exe')
driver.get('http://sub.domain.com:9300/bi/?legacyLogin=%2fbi%2fv1%2fdisp%3f%26b_action%3dxts.run%26c_cmd%3d..%252ftm1%252fweb%252ftm1web.html%26server%3dTOTO%26ps%3dhttps%253a%252f%252fsub2.domain.com%252app%26pg%3dapplications.jsp%253fAdminHost%253dsub.domain.com%2526TM1Server%253dTOTO%26host%3dsub.domain.com%26encoding%3dUTF-8%26m%3dportal%252fbridge.xts%26c_env%3dportal%252fvariables_TM1.xml')
time.sleep(3)
driver.find_element_by_id("username").send_keys('MyLogin')
driver.find_element_by_id("password").send_keys('MyPassword')
driver.find_element_by_id("login").click()
time.sleep(3)
cam_passport = re.search('cam_passport=(.+?)$', driver.current_url).group(1)
driver.close()
return 'CAMPassport ' + cam_passport
Hope it help.
Hi @EdouarL,
thank you for posting your solution. Very much appreciated.
It would be great if you create a Pull Request so that we can incorporate your change into the RestService in TM1py.
Hi team,
I stuck on this. Could you help ?
I take a look on https://github.com/cubewise-code/tm1py/issues/124 but Cognos is not configured to use SSO. We log with LDAP. But there is also a custom java provider
Here my configuration TM1 and Cognos both on 2 different Windows environment
TM1s.cfg
config.ini
Here the code with python.exe
If gateway is not empty in config.ini I get
If gateway is empty in config.ini I get :
many thanks for any help you could give me ! Ed