Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Azure- Issue "ACS communication over HTTPS to get WRAP token

$
0
0

Getting below errors when trying get WRAP token by "ACS communication over HTTPS.   

==== Sample that we tried====

// This method calls the Azure Access Control Service (ACS) to obtain a WRAP token
        // that grants the bearer to perform on operation on the specified namespace.
        static string GetAcsToken(string serviceNamespace, string issuerName, string issuerSecret)
        {
            var acsEndpoint = "https://" + serviceNamespace + "-sb.accesscontrol.windows.net/WRAPv0.9/";

            // Note that the realm used when requesting a token uses the HTTP scheme,
            // even though calls to the service are always issued over HTTPS.
            var realm = "https://" + serviceNamespace + ".servicebus.windows.net/";

            NameValueCollection values = new NameValueCollection();
            values.Add("wrap_name", issuerName);
            values.Add("wrap_password", issuerSecret);
            values.Add("wrap_scope", realm);

            WebClient webClient = new WebClient();
            byte[] response = webClient.UploadValues(acsEndpoint, values);

            string responseString = Encoding.UTF8.GetString(response);

            var responseProperties = responseString.Split('&');
            var tokenProperty = responseProperties[0].Split('=');
            var token = Uri.UnescapeDataString(tokenProperty[1]);

            Console.WriteLine("Token: " + token);
            return "WRAP access_token=\"" + token + "\"";
        }

==================

   at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data)
   at Microsoft.ServiceBus.HttpClient.Program.GetAcsToken(String serviceNamespace, String issuerName, String issuerSecret) in d:\Service Bus HTTP Token Providers\C#\ServiceBusHttpTokenProvider\Program.cs:line 173
   at Microsoft.ServiceBus.HttpClient.Program.Main(String[] args) in d:\Service Bus HTTP Token Providers\C#\ServiceBusHttpTokenProvider\Program.cs:line 59
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Any suggestion on how to use HTTPS to get WRAP token.?


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>