I have my username and password in a KVM how can i encode it to base64 and use it as a header?

Not applicable

my user name and password is stored in a kvm, i will use a kvm policy to retrieve those 2 variables. however, how do i encode those 2 to base64 so i can use it as header to my target request? I am thinking using KVM and AM message, but i dont know how to encode it to base64 before the AM policy

1 1 522
1 REPLY 1

There is a BasicAuthentication policy that does exactly this.

<BasicAuthentication name="CreateBasicAuthHeader">
   <Operation>Encode</Operation>
   <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
   <User ref="retrieved-from-kvm.username" />
   <Password ref="retrieved-from-kvm.password" />
   <AssignTo>request.header.Authorization</AssignTo>
</BasicAuthentication>