How to implement Web service Basic Authentication without using identity activity?

How to implement Web service Basic Authentication without using identity activity?

book

Article ID: KB0085486

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:

BW basic authentication requires client to provide username and password in “identity” activity. However, customer needs to change the password without restarting BW. The “identity” activity does not support this and we have to manually implement it in BW.

Issue/Introduction

How to implement Web service Basic Authentication without using identity activity?

Resolution

First of all, we need to add an additional HTTP header “Authorization” into the “Send HTTP Request” activity. The value of this “Authorization” header can be created like this in Java code:

function make_base_auth(user, password) { 

  var tok = user + ':' + pass; 

  var hash = Base64.encode(tok); 

  return "Basic " + hash; 

}

In BW, create the value like this:

concat('Basic ', tib:string-to-base64(concat($username, ':', $password)))


You need to store the user name and password in a file or DB. Use BW to read the user name and password dynamically from the file or DB. See the attached sample project (Filename: basic_authentication_468916.zip).



Attachments

How to implement Web service Basic Authentication without using identity activity? get_app