Discussion:
[jboss-user] [jBPM] - Problem with jbpm-console (business-central) in BRMS server
Jose Miguel Loor
2013-02-08 22:34:20 UTC
Permalink
Jose Miguel Loor [https://community.jboss.org/people/jmiguel77] created the discussion

"Problem with jbpm-console (business-central) in BRMS server"

To view the discussion, visit: https://community.jboss.org/message/796846#796846

--------------------------------------------------------------
Hi

I am trying to access the REST api that is included in the BRMS server, but the problem is that the brms-central-server has FORM authentication by default:

<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
      <form-login-page>/login.html</form-login-page>
      <form-error-page>/login_failed.html</form-error-page>
    </form-login-config>
  </login-config>

And i have found no way to access the REST resources with a client that handles that kind of authentication. So, i changed it to BASIC auth:

<login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>GWT Console Server</realm-name>
  </login-config>

This i did, by editing the file in brms-standalone-5.3.0/jboss-as/server/default/deploy/business-central-server.war/WEB-INF/web.xml. After this change, i am able to interact with the REST resources.

But, the jbpm console gui (/business-central/app.html) is not working anymore. I introduced the correct user / password and cannot login to the jbpm console.

What else do i need to configure to have both systems working correctly ??
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796846#796846]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maurice de Chateau
2013-02-09 17:45:52 UTC
Permalink
Maurice de Chateau [https://community.jboss.org/people/MohReece] created the discussion

"Re: Problem with jbpm-console (business-central) in BRMS server"

To view the discussion, visit: https://community.jboss.org/message/796892#796892

--------------------------------------------------------------
Hi Jose,

Maybe not the answer to the question you're asking, but it may be one that addresses your problem: you can access the Business Central REST API, but it's a little 'tricky' to getting around the form authentication to get there.

When you first access the API with e.g. the Apache DefaultHttpClient, the response will contain the HTML containing the form. Upon that response, you need to POST the credentials:


        final DefaultHttpClient httpClient = new DefaultHttpClient();
        final String url = BUSINESS_CENTRAL_REST_BASE_URL + RESOURCE_PATH + "/j_security_check";

        final List<NameValuePair> formParms = new ArrayList<NameValuePair>();
        formParms.add(new BasicNameValuePair("j_username", BUSINESS_CENTRAL_USER_NAME));
        formParms.add(new BasicNameValuePair("j_password", BUSINESS_CENTRAL_PASSWORD));

        String responseString = null;
        try {
            final HttpPost httpPost = new HttpPost(url);
            httpPost.setEntity(new UrlEncodedFormEntity(formParms, "UTF-8"));

            final HttpResponse response = httpClient.execute(httpPost);
            responseString = EntityUtils.toString(response.getEntity());
            EntityUtils.consume(response.getEntity());
        } catch (final Exception e) {
            e.printStackTrace();
        }



When this returns with an HTTP 200 response you can retry your original request - which should succeed.

Basically, this is the same scenario that a browser goes through in the case of form authentication. Now one can certainly argue that this kind of authentication doesn't belong on a (true) REST interface, as it relies on server state (you only log in once per session, and the server remembers your credentials for that session) which goes against REST's principle of stateless-ness. But I guess for now we just have to make do with the implementation the Business Central server is providing us...
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796892#796892]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
rigazilla
2013-04-11 14:10:07 UTC
Permalink
rigazilla [https://community.jboss.org/people/rigazilla] created the discussion

"Re: Problem with jbpm-console (business-central) in BRMS server"

To view the discussion, visit: https://community.jboss.org/message/807747#807747

--------------------------------------------------------------
Hi Jose,

I also need to run the jbpm-console with basic authentication.

Did you find a solution to this problem?

Thanks,
Vittorio
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807747#807747]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jose Miguel Loor
2013-04-11 15:04:46 UTC
Permalink
Jose Miguel Loor [https://community.jboss.org/people/jmiguel77] created the discussion

"Re: Problem with jbpm-console (business-central) in BRMS server"

To view the discussion, visit: https://community.jboss.org/message/807776#807776

--------------------------------------------------------------
Hi Vittorio

Sadly no, i had to build my solution working against the form authentication

I can help you with some code, if you need it
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807776#807776]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
rigazilla
2013-04-12 08:36:23 UTC
Permalink
rigazilla [https://community.jboss.org/people/rigazilla] created the discussion

"Re: Problem with jbpm-console (business-central) in BRMS server"

To view the discussion, visit: https://community.jboss.org/message/807967#807967

--------------------------------------------------------------
Hi Jose,

we decided to go for a separated war for our rest services with basic authentication.

So basically this will be our arch:
gwt-console + server as is, with form auth
war with business rest service with basic auth

Thanks for you offer to share you code with us!

Ciao,
Vittorio
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807967#807967]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...