WebAccountProviderRequestTokenOperation 类

定义

表示请求令牌操作。

public ref class WebAccountProviderRequestTokenOperation sealed : IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class WebAccountProviderRequestTokenOperation final : IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class WebAccountProviderRequestTokenOperation : IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
Public NotInheritable Class WebAccountProviderRequestTokenOperation
Implements IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
继承
Object Platform::Object IInspectable WebAccountProviderRequestTokenOperation
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

下面演示了如何处理请求令牌操作的示例:

WebAccountProviderRequestTokenOperation webAccountProviderRequestTokenOperation;
string accessToken;

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    this.webAccountProviderRequestTokenOperation = 
        (WebAccountProviderRequestTokenOperation)e.Parameter;
    base.OnNavigatedTo(e);
}

private void Authentication_Click(object sender, RoutedEventArgs e)
{
    Uri uri;
    if (webAccountProviderRequestTokenOperation != null)
    {
        // Build the URI using information about the web account from the request
        uri = new Uri("INSERT URI HERE"); 
    }
    else
    {
        // Build the Uri using user-entered information
        uri = new Uri("INSERT URI HERE"); 
    }
    // Complete authentication using the built Uri
    WebTokenResponse response = new WebTokenResponse(this.accessToken);
    WebProviderTokenResponse providerResponse = 
        new WebProviderTokenResponse(response, DateTimeOffset.Now.AddHours(1));
    webAccountProviderRequestTokenOperation.ProviderResponses.Add(providerResponse);
    // Return the result
    WebAccountManager.SendTokenResultCompleted(webAccountProviderOperation);
}    

属性

CacheExpirationTime

获取或设置缓存过期时间。

Kind

获取 Web 帐户提供程序操作的类型。

ProviderRequest

获取 Web 提供程序令牌请求。

ProviderResponses

获取 Web 提供程序令牌响应。

方法

ReportCompleted()

通知激活应用操作已成功完成。

ReportError(WebProviderError)

通知激活应用操作遇到错误。

ReportUserCanceled()

通知激活应用用户取消了该操作。

适用于

另请参阅