In continuation to the last blog, we will see the second approach to read the credential details from a Service Account and pass these to target system. It is quite safe to use in OSB to save credentials and authentication.
{funcLookup:getUserName("ServiceAccountlookup/ServiceAccount")}
{funcLookup:getPassword("ServiceAccountlookup/ServiceAccount")}
- create a service account, select resource type as "Static" and update the credentials.
- create relevant proxy, biz services.
- Now create one dummy Xquery selecting target schema structure, which will read created service account and assign value to target xml elements, named as lookupPassword.xq in my case as below
declare namespace ns0 = "http://www.example.org/sayHello/";
declare namespace funcLookup = "http://tempuri.org/ServiceAccountlookup/Funclookup/";
declare namespace ns1 = "http://www.example.org/request/";
declare namespace xf = "http://tempuri.org/ServiceAccountlookup/lookupPasswrd/";
declare namespace con ="http://www.bea.com/wli/sb/services/security/config";
declare function funcLookup:getUserName($usernameVar as xs:string) as xs:string
{
let $data := fn-bea:lookupBasicCredentials($usernameVar)
return
if (exists($data/con:username/text()))
then $data/con:username/text()
else ""
};
declare function funcLookup:getPassword($passwordVar as xs:string) as xs:string
{
let $data := fn-bea:lookupBasicCredentials($passwordVar)
return
if (exists($data/con:password/text()))
then $data/con:password/text()
else "as"
};
declare function xf:lookupPasswrd($newOperation1 as element(ns1:NewOperation))
as element(ns0:NewOperation) {
};
1 comment:
HI RAVI
Nice post .could you pls explain how to do service account flexible means runtime change
Post a Comment