Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

httpbasic and multitenancy

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm about to implement httpbasic + apikey authentication with multitenancy.
What I mean... I'd like to create procedure with input parameters for username, password and apikey, so that users could use it with their own credentials, not only with stored default creds.

Below is how it works in sql without multitenancy.


EXEC SYSADMIN.createConnection("name" => 'webservice1', "jbossCLITemplateName" => 'name1', "connectionOrResourceAdapterProperties" => 'EndPoint=https://api.example.com/api/,SecurityType=HTTPBasic,AuthUserName=[EMAIL]', "encryptedProperties" => 'AuthPassword=[PASSWORD]') ;;
EXEC SYSADMIN.createDataSource("name" => 'webservice1', "translator" => 'name1', "modelProperties" => '', "translatorProperties" => '', "encryptedModelProperties" => '', "encryptedTranslatorProperties" => '') ;;




exec webservice1.invokeHTTP(endpoint=>'2.0/checks',requestHeaders=> App-Key: myapikey1 ,action=>'GET',requestContentType=>'application/xml')



Now I'm trying to create connection without authusername and authpassword and it does work


EXEC SYSADMIN.createConnection("name" => 'webservice1', "jbossCLITemplateName" => 'name1', "connectionOrResourceAdapterProperties" => 'EndPoint=https://api.example.com/api/,SecurityType=HTTPBasic') ;;
EXEC SYSADMIN.createDataSource("name" => 'webservice1', "translator" => 'name1', "modelProperties" => '', "translatorProperties" => '', "encryptedModelProperties" => '', "encryptedTranslatorProperties" => '') ;;



but then I'm trying to call my webservice with credentials entered manually


exec webservice1.invokeHTTP(endpoint=>'2.0/checks',requestHeaders=> AuthUserName: user1 || AuthPassword: pass1 || App-Key: myapikey1,action=>'GET',requestContentType=>'application/xml')



but receive error:


Server returned HTTP response code: 401 for URL: https://api.example.com/api//2.0/test1** http error stream***{"error":{"statuscode":401,"statusdesc":"Unauthorized","errormessage":"User credentials missing"}}



How do I implement multitenancy for httpbasic auth without need to recreate the connection?
Please advise.
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic