OSB: Configurable basic authentication

Basic authentication is still a very common approach for securing web services. It is widely supported and can be tested with a browser. If used over a HTTPS connection also the credentials are encrypted.

To use basic authentication the usual way with OSB it is necessary to select ‘Basic’ at the authentication section and a service account for the business service:

BLOG_OSB_BasicAuthentication_01

For the service account the OSB supports three settings:

BLOG_OSB_BasicAuthentication_02

  • Pass Through: The credentials provided to the proxy service are forwarded to the business service.
  • Static: You enter the credentials to the service account file.
  • Mapping: You create inside the service account file a mapping from local usernames to remote usernames and passwords.

There is a problem with all three selections: If you are on enterprise level where you use a version control system, build OSB projects with a build process and want to deploy the project on different stages with different credentials, they will not support this.

It is not possible to modify the service account file with the customization mechanism.

A working solution is to create different service account files for each stage and select the needed one by customization. But there is still the problem, that you need to check in the production credentials into the version control system.

A workaround for this would be to have an apart configuration project with restricted access referenced by the project containing the business service.

I would like to show another solution here. As described in this blog post we have chosen to store all kind of settings of the OSB projects in a configuration file on the OSB server. Access to these settings happens through custom XQuery functions. Using this we are able to get username and password stored in an OSB variables. For details look at this topic.

How we can use these credentials?

First we have to build a basic authentication string. According to wiki we have to concatenate username and password and then do a base64 encoding. This can be done with a java callout or the already base64-encoded string can be stored in the configuration file.

BLOG_OSB_BasicAuthentication_03

Then we change the authentication of the business service to ‘None’. The service account is not needed anymore.

BLOG_OSB_BasicAuthentication_04

The last step is to add the basic authentication header to the outbound request. This can happen inside the routing or the service callout.

BLOG_OSB_BasicAuthentication_05

Now we can configure the credentials we want to pass to the business service in our configuration file.

 

Bernhard Mähr @ OPITZ-CONSULTING published at https://thecattlecrew.wordpress.com/

Über bmaehr

Ich bin ein Technik-Fan, der in der Informatik seinen Beruf und seine Berufung gefunden hat.
Dieser Beitrag wurde unter BPM & System Integration abgelegt und mit , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s