OnlineIdServiceTicketRequest 类

定义

使应用能够指定用于对 Live 用户进行身份验证以获取标识属性和票证的服务和策略。

注意

如果要针对Windows 10或更高版本进行开发,请改用 Windows.Security.Authentication.Web.Core API。 有关详细信息,请参阅 Web 帐户管理器

public ref class OnlineIdServiceTicketRequest sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Security.Authentication.OnlineId.IOnlineIdServiceTicketRequestFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class OnlineIdServiceTicketRequest final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Security.Authentication.OnlineId.IOnlineIdServiceTicketRequestFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class OnlineIdServiceTicketRequest final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Security.Authentication.OnlineId.IOnlineIdServiceTicketRequestFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class OnlineIdServiceTicketRequest
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Security.Authentication.OnlineId.IOnlineIdServiceTicketRequestFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class OnlineIdServiceTicketRequest
function OnlineIdServiceTicketRequest(service, policy)
Public NotInheritable Class OnlineIdServiceTicketRequest
继承
Object Platform::Object IInspectable OnlineIdServiceTicketRequest
属性

Windows 要求

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

示例

以下示例演示如何指定用于对 Live 用户进行身份验证的服务和策略。

function signIn() {
    var authenticator = new Windows.Security.Authentication.OnlineId.OnlineIdAuthenticator();
    var serviceTicketRequest = new Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest(
        "wl.basic wl.contacts_photos wl.calendars", "DELEGATION");

    sdkSample.displayStatus("Signing in...");

    authenticator.authenticateUserAsync(serviceTicketRequest)
        .done(function (authResult) {

            if ((authResult.tickets.size == 1) && (authResult.tickets[0].errorCode == 0)) {
                sdkSample.isSignedIn = true;
                sdkSample.displayStatus("Authorization succeeded.");
                sdkSample.accessToken = authResult.tickets[0];
                sdkSample.canSignOut = authenticator.canSignOut;
            }
        },

            function (authStatus) {
                if (authStatus && (authStatus.name !== "Canceled")) {
                    showErrorMessage("Autorization failed: " + authStatus.message);
                } else {
                    sdkSample.displayStatus("");
                }
                    showAccountStatus();
                });
}

构造函数

OnlineIdServiceTicketRequest(String)

创建 OnlineIdServiceTicketRequest 类的实例。

注意

如果要针对Windows 10或更高版本进行开发,请改用 Windows.Security.Authentication.Web.Core API。 有关详细信息,请参阅 Web 帐户管理器

OnlineIdServiceTicketRequest(String, String)

创建 OnlineIdServiceTicketRequest 类的实例。

注意

如果要针对Windows 10或更高版本进行开发,请改用 Windows.Security.Authentication.Web.Core API。 有关详细信息,请参阅 Web 帐户管理器

属性

Policy

用于对用户进行身份验证的策略。 支持的值是 JWT,它使用 JSON 格式返回数据。 对于请求用户同意访问存储在 Live 中的应用,应用开发人员必须通过委派策略。

注意

如果要针对Windows 10或更高版本进行开发,请改用 Windows.Security.Authentication.Web.Core API。 有关详细信息,请参阅 Web 帐户管理器

Service

标识应用使用的服务。 服务名称必须与在 上 http://go.microsoft.com/fwlink/p/?linkid=241860注册应用时提供的 DNS 名称匹配。 仅为此服务颁发票证。 对于请求用户同意访问存储在 Live 中的应用,你必须传递应用需要访问的产品/服务。 可在我们的 “范围和权限” 页中找到可用的产品/服务列表。 然后,可以将票证与 Live Connect REST API 一起使用,以访问用户已同意提供给应用的数据。 请查看 REST API 主题了解详细信息。 或者,应用可以使用 Live Connect SDK,该 SDK 将自行进行这些调用。

注意

如果要针对Windows 10或更高版本进行开发,请改用 Windows.Security.Authentication.Web.Core API。 有关详细信息,请参阅 Web 帐户管理器

适用于