本文整理汇总了C#中System.Web.HttpRequestBase.AsHttpRequestMessage方法的典型用法代码示例。如果您正苦于以下问题:C# HttpRequestBase.AsHttpRequestMessage方法的具体用法?C# HttpRequestBase.AsHttpRequestMessage怎么用?C# HttpRequestBase.AsHttpRequestMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpRequestBase
的用法示例。
在下文中一共展示了HttpRequestBase.AsHttpRequestMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessUserAuthorizationAsync
/// <summary>
/// Processes the authorization response from an authorization server, if available.
/// </summary>
/// <param name="request">The incoming HTTP request that may carry an authorization response.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The authorization state that contains the details of the authorization.</returns>
public Task<IAuthorizationState> ProcessUserAuthorizationAsync(
HttpRequestBase request = null, CancellationToken cancellationToken = default(CancellationToken)) {
request = request ?? this.Channel.GetRequestFromContext();
return this.ProcessUserAuthorizationAsync(request.AsHttpRequestMessage(), cancellationToken);
}
示例2: HandleTokenRequestAsync
/// <summary>
/// Handles an incoming request to the authorization server's token endpoint.
/// </summary>
/// <param name="request">The HTTP request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// The HTTP response to send to the client.
/// </returns>
public Task<HttpResponseMessage> HandleTokenRequestAsync(HttpRequestBase request = null, CancellationToken cancellationToken = default(CancellationToken)) {
request = request ?? this.Channel.GetRequestFromContext();
return this.HandleTokenRequestAsync(request.AsHttpRequestMessage(), cancellationToken);
}
示例3: ReadAuthorizationRequestAsync
/// <summary>
/// Reads in a client's request for the Authorization Server to obtain permission from
/// the user to authorize the Client's access of some protected resource(s).
/// </summary>
/// <param name="request">The HTTP request to read from.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// The incoming request, or null if no OAuth message was attached.
/// </returns>
/// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception>
public Task<EndUserAuthorizationRequest> ReadAuthorizationRequestAsync(
HttpRequestBase request = null, CancellationToken cancellationToken = default(CancellationToken)) {
request = request ?? this.Channel.GetRequestFromContext();
return this.ReadAuthorizationRequestAsync(request.AsHttpRequestMessage(), cancellationToken);
}
示例4: GetAccessTokenAsync
/// <summary>
/// Discovers what access the client should have considering the access token in the current request.
/// </summary>
/// <param name="httpRequestInfo">The HTTP request info.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="requiredScopes">The set of scopes required to approve this request.</param>
/// <returns>
/// The access token describing the authorization the client has. Never <c>null</c>.
/// </returns>
/// <exception cref="ProtocolFaultResponseException">Thrown when the client is not authorized. This exception should be caught and the
/// <see cref="ProtocolFaultResponseException.ErrorResponseMessage" /> message should be returned to the client.</exception>
public virtual Task<AccessToken> GetAccessTokenAsync(HttpRequestBase httpRequestInfo = null, CancellationToken cancellationToken = default(CancellationToken), params string[] requiredScopes) {
Requires.NotNull(requiredScopes, "requiredScopes");
RequiresEx.ValidState(this.ScopeSatisfiedCheck != null, Strings.RequiredPropertyNotYetPreset);
httpRequestInfo = httpRequestInfo ?? this.Channel.GetRequestFromContext();
return this.GetAccessTokenAsync(httpRequestInfo.AsHttpRequestMessage(), cancellationToken, requiredScopes);
}
示例5: ReadProtectedResourceAuthorizationAsync
/// <summary>
/// Gets the authorization (access token) for accessing some protected resource.
/// </summary>
/// <param name="request">The incoming HTTP request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The authorization message sent by the Consumer, or null if no authorization message is attached.</returns>
/// <remarks>
/// This method verifies that the access token and token secret are valid.
/// It falls on the caller to verify that the access token is actually authorized
/// to access the resources being requested.
/// </remarks>
/// <exception cref="ProtocolException">Thrown if an unexpected message is attached to the request.</exception>
public Task<AccessProtectedResourceRequest> ReadProtectedResourceAuthorizationAsync(HttpRequestBase request = null, CancellationToken cancellationToken = default(CancellationToken)) {
request = request ?? this.channel.GetRequestFromContext();
return this.ReadProtectedResourceAuthorizationAsync(request.AsHttpRequestMessage(), cancellationToken);
}
示例6: ProcessUserAuthorizationAsync
/// <summary>
/// Processes the authorization response from an authorization server, if available. Hides WebClient.ProcessUserAuthorizationAsync
/// </summary>
/// <param name="request">The incoming HTTP request that may carry an authorization response.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The authorization state that contains the details of the authorization.</returns>
public new Task<IAuthorizationState> ProcessUserAuthorizationAsync(HttpRequestBase request = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Not sexy way of getting the request, but since we can't access this.Channel.GetRequestFromContext(), we go deeper.
request = request ?? new HttpRequestWrapper(HttpContext.Current.Request);
return this.ProcessUserAuthorizationAsync(request.AsHttpRequestMessage(), cancellationToken);
}