Login to bonita Portal with certain user with new parameters in url

1
0
-1

I have an application that need to communicate with Bonita through the REST API. I need to login to bonita Portal with certain user with new parameters in url. Here is my url and i can login my Bonita app.
http://HOST_NAME_HERE:PORT_NUMBER_HERE/bonita/loginservice?username=USER_NAME_HERE&password=PASSWORD_HERE&redirectUrl=portal%2Fhomepage&token=xxxx

My question is: after login Bonita portal, is there any way i can get token=xxxx in URL and set it as process variable? I need this token in later process step. Any example welcomes!

thanks,

Comments

Submitted by dding_1375128 on Tue, 09/18/2018 - 17:18

BTW, i use community version 7.7.3. can not do REST API extensions

Submitted by dding_1375128 on Wed, 09/19/2018 - 22:54

Hi Antonie:
Thanks for your example. Actually my use case has two requirements. 1) login Bonita app with anonymous user and redirected to init process. 2) parser parameters from URL ( token=xxx) and save it to bdm for audit.

We have only one URL, with one user click to do these two requirements.

URL i got to integrate with another app like this:

http://HOST_NAME_HERE:PORT_NUMBER_HERE/bonita/loginservice?username=USER_NAME_HERE&password=PASSWORD_HERE&redirectUrl=portal%2Fhomepage&token=xxxx

For requirement 1), it works fine. I can login and be redirected to home page.
For requirement 2), i know we need to create a REST API extension to parse url parameters..

but since we already use build-in loginservice as handler to parse URL( username and password), can i modify it instead of create new API extension? Or how new API get call from build-in loginservice after authorization pass using above URL? Or you have new way to complete these two requirements?

I appreciate your answer!

Submitted by antoine.mottier on Thu, 09/20/2018 - 10:46

I update my original answer based on your extra information.

1 answer

1
0
-1

Actually it is possible to use Bonita REST API even in Community Edition of Bonita.

I recommend you read this documentation page that explain how to use the Bonita REST API.

Depending on your use case you might need to create a REST API extension. You can do this also in Community Edition even if it is not currently well documented (I'm working on improving that). You can learn how to create such extension using the Data source REST API extension example.

Based on your extra information here is an update of my original answer: If you managed to automate the login and redirection to a Bonita form you can then define in Bonita form a variable of type "URL parameter" that will be able to capture the information passed in the URL (e.g. the value of your token parameter). You can then make this variable part of the information sent when clicking on the submit button (bind the variable to the submit button) and then capture it in the process instantiation contract and use it in process business variable default value.

Comments

Submitted by dding_1375128 on Fri, 09/21/2018 - 21:03

Hi Antonie:
Thanks for suggestion. I define in my redirected Bonita form a variable ( name as tokenData, value = token) as of type "URL parameter", that will be able to capture the information passed in the URL (e.g. the value of token parameter). Following is my url to do auto login and redirect to form.

http://HOST_NAME_HERE:PORT_NUMBER_HERE/bonita/loginservice?username=USER_NAME_HERE&password=PASSWORD_HERE&redirectUrl=/bonita/portal/resource/process/process_name/1.10/content/?id=6090246829515228480&token=8059573970941793115

When i clicked this link, i can autologin and redirect to form successfully. I can get process id=6090246829515228480.

But i still can NOT get token=8059573970941793115

After redirected to form page, URL in browser shows /bonita/portal/resource/process/process_name/1.10/content/?id=6090246829515228480
without token=8059573970941793115

I compared id and token, both variable set up in form are same.( mapping, type are correct). Any hint?

thanks!

Submitted by antoine.mottier on Wed, 10/17/2018 - 12:13

Hi,

I did a test with process instantiation form an I manage to successfully get the parameter value in my form. Just note that the redirectUrl parameter value need to be encored. E.g. : http://localhost:8080/bonita/login.jsp?redirectUrl=%2Fbonita%2Fportal%2F...

Let me know if you want me to share a process example.

Notifications