/// <summary>
        /// GetAzureAvailableAuthenticationMethods method implementation
        /// </summary>
        private GetAvailableAuthenticationMethodsResponse GetAzureAvailableAuthenticationMethods(AuthenticationContext ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (string.IsNullOrEmpty(ctx.UPN))
            {
                throw new InvalidDataException("No user identity was provided.");
            }

            GetAvailableAuthenticationMethodsRequest request = new GetAvailableAuthenticationMethodsRequest()
            {
                UserPrincipalName = ctx.UPN, ContextId = ctx.ActivityId
            };
            GetAvailableAuthenticationMethodsResponse response;

            try
            {
                response = SasProvider.GetAvailableAuthenticationMethods(request);
            }
            catch (Exception ex)
            {
                throw new Exception("Exception calling SAS.", ex);
            }

            if (response.Result.Value != "Success")
            {
                throw new Exception(string.Format("Unexpected SAS response status code : {0}", response.Result.Value));
            }
            return(response);
        }
 /// <summary>
 /// GetAvailableAuthenticationMethods implmentation
 /// </summary>
 public GetAvailableAuthenticationMethodsResponse GetAvailableAuthenticationMethods(GetAvailableAuthenticationMethodsRequest request)
 {
     return(CreateMessage <GetAvailableAuthenticationMethodsRequest, GetAvailableAuthenticationMethodsResponse>(string.Format(CultureInfo.InvariantCulture, "{0}/{1}", new object[] { this._serviceUrl, "GetAvailableAuthenticationMethods" }), request, new Action <HttpWebRequest>(this.SetAuthenticationHeader)));
 }