We have used Basic Auth in other parts of our infrastructure with Great
success, but have not had the need to pass authentication from 4D, until
now.
We are trying to replace a SOAP service with a REST based 'pass through'
service.

Using HTTPS to protect a basic auth header meets the minimum requirements
for security.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#Basic_authentication_scheme

I have built a prototype web service to handle these requests, and can
interact with it via "postman"

Here is some generated code from the postman app:
wget --quiet \ --method GET \ --header 'authorization: Basic
TGFuZ2xvOlBhc3R1cml6ZWQ=' \ --output-document \ -
https://prototype.url.com/ppp/201905

Trying to build this out in 4D, I have the following:

C_TEXT(URLText_t)
C_TEXT(Text_t)
URLText_t:="https://prototype.url.com/ppp/201905";
ARRAY TEXT(HeaderNames_at;2)
ARRAY TEXT(HeaderValues_at;2)
HeaderNames_at{1}:="Username"
HeaderNames_at{2}:="Password"
HeaderValues_at{1}:="Langlo"
HeaderValues_at{2}:="Pasturized"
$httpResponse:=HTTP Get(URLText_t;Text_t;HeaderNames_at;HeaderValues_at)

However, 4D is not generating the correct (base64 encoded) header as it
initiates the HTTP Get.


In other languages (like Javascript) you can generate a base64 encoded
string like this:

var user = 'user';var password = 'password';var base64encodedData =
new Buffer(user + ':' + password).toString('base64');

I have looked at the base64-encode method for 4D, but am not sure how I
could accomplish the same thing.
https://doc.4d.com/4Dv16/4D/16.5/BASE64-ENCODE.301-4227612.en.html

Has anyone else already been down this road?
Any suggestions on passing HTTP auth out of 4D to an external service?

Many thanks,
Noah
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to