public string CreateRequest(string userSuppliedIdentifier, string realm, string returnToUrl)
        {
            OpenIdRelyingParty rp       = new OpenIdRelyingParty(null);
            UserAgentResponse  response = rp.CreateRequest(userSuppliedIdentifier, realm, new Uri(returnToUrl)).RedirectingResponse;

            return(response.DirectUriRequest.AbsoluteUri);
        }
예제 #2
0
        public Uri RequestUserAuthorization(IDictionary <string, string> requestParameters, IDictionary <string, string> redirectParameters, out string requestToken)
        {
            var message = this.PrepareRequestUserAuthorization(null, requestParameters, redirectParameters, out requestToken);
            UserAgentResponse response = this.Channel.PrepareResponse(message);

            return(response.DirectUriRequest);
        }
예제 #3
0
        public async Task <UserAgentResponse> GetUserAgentAsync(string networkAddress)
        {
            using (HttpClient client = new HttpClient())
            {
                String json = await client.GetStringAsync(String.Format("{0}/api/useragent", networkAddress));

                UserAgentResponse response = null;                 // JsonConvert.DeserializeObject<BE.Models.User.BankDepositDetails>(json);
                return(response);
            }
        }
예제 #4
0
        /// <summary>
        /// Queues a message for sending in the response stream where the fields
        /// are sent in the response stream in querystring style.
        /// </summary>
        /// <param name="response">The message to send as a response.</param>
        /// <returns>The pending user agent redirect based message to be sent as an HttpResponse.</returns>
        /// <remarks>
        /// This method implements spec V1.0 section 5.3.
        /// </remarks>
        protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response)
        {
            ErrorUtilities.VerifyArgumentNotNull(response, "response");

            MessageSerializer serializer = MessageSerializer.Get(response.GetType());
            var    fields       = serializer.Serialize(response);
            string responseBody = MessagingUtilities.CreateQueryString(fields);

            UserAgentResponse encodedResponse = new UserAgentResponse {
                Body            = responseBody,
                OriginalMessage = response,
                Status          = HttpStatusCode.OK,
                Headers         = new System.Net.WebHeaderCollection(),
            };

            IHttpDirectResponse httpMessage = response as IHttpDirectResponse;

            if (httpMessage != null)
            {
                encodedResponse.Status = httpMessage.HttpStatusCode;
            }

            return(encodedResponse);
        }
예제 #5
0
        /// <summary>
        /// Queues a message for sending in the response stream where the fields
        /// are sent in the response stream in querystring style.
        /// </summary>
        /// <param name="response">The message to send as a response.</param>
        /// <returns>
        /// The pending user agent redirect based message to be sent as an HttpResponse.
        /// </returns>
        /// <remarks>
        /// This method implements spec V1.0 section 5.3.
        /// </remarks>
        protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response)
        {
            ErrorUtilities.VerifyArgumentNotNull(response, "response");

            var serializer = MessageSerializer.Get(response.GetType());
            var fields     = serializer.Serialize(response);

            byte[] keyValueEncoding = KeyValueFormEncoding.GetBytes(fields);

            UserAgentResponse preparedResponse = new UserAgentResponse();

            preparedResponse.Headers.Add(HttpResponseHeader.ContentType, KeyValueFormContentType);
            preparedResponse.OriginalMessage = response;
            preparedResponse.ResponseStream  = new MemoryStream(keyValueEncoding);

            IHttpDirectResponse httpMessage = response as IHttpDirectResponse;

            if (httpMessage != null)
            {
                preparedResponse.Status = httpMessage.HttpStatusCode;
            }

            return(preparedResponse);
        }
예제 #6
0
 /// <summary>
 /// Resets any user agent response that may have been created already and cached.
 /// </summary>
 protected void ResetUserAgentResponse()
 {
     this.cachedUserAgentResponse = null;
 }