PassportIdentity.GetIsAuthenticated 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指示用户是否由 Passport 颁发机构进行身份验证。 此类已弃用。
重载
GetIsAuthenticated(Int32, Boolean, Boolean) |
指示用户是否由负责 Passport 身份验证的中心站点进行身份验证。 此类已弃用。 |
GetIsAuthenticated(Int32, Int32, Int32) |
指示用户是否由 Passport 颁发机构进行身份验证。 此类已弃用。 |
注解
此类已被弃用,不再受支持。 Microsoft Passport Network 已替换为 Windows Live ID。
GetIsAuthenticated(Int32, Boolean, Boolean)
指示用户是否由负责 Passport 身份验证的中心站点进行身份验证。 此类已弃用。
public:
bool GetIsAuthenticated(int iTimeWindow, bool bForceLogin, bool bCheckSecure);
public bool GetIsAuthenticated (int iTimeWindow, bool bForceLogin, bool bCheckSecure);
member this.GetIsAuthenticated : int * bool * bool -> bool
Public Function GetIsAuthenticated (iTimeWindow As Integer, bForceLogin As Boolean, bCheckSecure As Boolean) As Boolean
参数
- iTimeWindow
- Int32
指定成员必须在此期间最终登录到调用域的时间间隔。 传递 -1 以指示 Passport 应使用默认值。
- bForceLogin
- Boolean
确定如何使用 iTimeWindow
参数。
- bCheckSecure
- Boolean
启用加密登录的检查。 SSL 登录不是当前版本登录服务器中的可用选项,所以传入的值在服务器上被忽略。
返回
如果用户由 Passport 颁发机构进行身份验证,则为 true
;否则为 false
。
注解
此类已被弃用,不再受支持。 Microsoft Passport Network 已替换为 Windows Live ID。
适用于
GetIsAuthenticated(Int32, Int32, Int32)
指示用户是否由 Passport 颁发机构进行身份验证。 此类已弃用。
public:
bool GetIsAuthenticated(int iTimeWindow, int iForceLogin, int iCheckSecure);
public bool GetIsAuthenticated (int iTimeWindow, int iForceLogin, int iCheckSecure);
member this.GetIsAuthenticated : int * int * int -> bool
Public Function GetIsAuthenticated (iTimeWindow As Integer, iForceLogin As Integer, iCheckSecure As Integer) As Boolean
参数
- iTimeWindow
- Int32
指定成员必须在此期间最终登录到调用域的时间间隔。 值 -1 指示 Passport 应使用默认值,0 表示 false
,而 1 表示 true
。
- iForceLogin
- Int32
确定如何使用 iTimeWindow
参数。 值 -1 指示 Passport 应使用默认值,0 表示 false
,而 1 表示 true
。
- iCheckSecure
- Int32
启用加密登录的检查。 值 -1 指示 Passport 应使用默认值,0 表示 false
,而 1 表示 true
。
Passport 版本 2.1 登录服务器的值 10 或 100 为 Passport 管理器 IsAuthenticated
方法指定 SecureLevel
10 或 100。 有关详细信息,请参阅 Passport 版本 2.1 SDK 文档。
SSL 登录不是 Passport 版本 1.4 登录服务器中的可用选项。 iCheckSecure
的值在服务器上被忽略。
返回
如果用户由负责 Passport 身份验证的中心站点进行身份验证,则为 true
;否则为 false
。
示例
<!--
This example demonstrates implementing the soft sign-in authentication approach.
In order for the example to work, the following requirements must be met.
You can find details on these requirements in the Passport SDK documentation.
1. You must modify the Web.config file associated with this page so that
authentication mode is set to "Passport".
2. You must have the Passport SDK installed.
3. You must have a Passport Site ID for the site where your page resides.
If your Site ID is in the PREP environment, you will also need a PREP Passport.
4. You must have installed the encryption key you received after registering
your site and receiving a site ID.
5. You must have the Passport Manager object settings correctly configured for
your site.
-->
<!--
This example demonstrates implementing the soft sign-in authentication approach.
In order for the example to work, the following requirements must be met.
You can find details on these requirements in the Passport SDK documentation.
1. You must modify the Web.config file associated with this page so that
authentication mode is set to "Passport".
2. You must have the Passport SDK installed.
3. You must have a Passport Site ID for the site where your page resides.
If your Site ID is in the PREP environment, you will also need a PREP Passport.
4. You must have installed the encryption key you received after registering your
site and receiving a site ID.
5. You must have the Passport Manager object settings correctly configured for your site.
-->
<!-- To view this code example in a fully-working sample, see the
PassportIdentity Class topic. -->
<!-- To view this code example in a fully-working sample, see the
PassportIdentity Class topic. -->
PassportIdentity identity = (this.Context.User.Identity as PassportIdentity);
// Determine whether the user is already signed in with a valid
// and current ticket. Passing -1 for the parameter values
// indicates the default values will be used.
if (identity.GetIsAuthenticated(-1, -1, -1))
{
this.Response.Write("Welcome to the site.<br /><br />");
// Print the Passport sign in button on the screen.
this.Response.Write(identity.LogoTag2());
// Make sure the user has core profile information before
// trying to access it.
if (identity.HasProfile("core"))
{
this.Response.Write("<b>You have been authenticated as " +
"Passport identity:" + identity.Name + "</b></p>");
}
}
// Determine whether the user has a ticket.
else if (identity.HasTicket)
{
// If the user has a ticket but wasn't authenticated, that
// means the ticket is stale, so the login needs to be refreshed.
// Passing true as the fForceLogin parameter value indicates that
// silent refresh will be accepted.
identity.LoginUser(null, -1, true, null, -1, null, -1, true, null);
}
Dim identity As PassportIdentity = Me.Context.User.Identity
' Determine whether the user is already signed in with a valid
' and current ticket. Passing -1 for the parameter values
' indicates the default values will be used.
If (identity.GetIsAuthenticated(-1, -1, -1)) Then
Me.Response.Write("Welcome to the site.<br /><br />")
' Print the Passport sign in button on the screen.
Me.Response.Write(identity.LogoTag2())
' Make sure the user has core profile information before
' trying to access it.
If (identity.HasProfile("core")) Then
Me.Response.Write("<b>You have been authenticated as " & _
"Passport identity:" & identity.Name & "</b></p>")
End If
' Determine whether the user has a ticket.
ElseIf identity.HasTicket Then
' If the user has a ticket but wasn't authenticated, that
' means the ticket is stale, so the login needs to be refreshed.
' Passing true as the fForceLogin parameter value indicates that
' silent refresh will be accepted.
identity.LoginUser(Nothing, -1, True, Nothing, -1, Nothing, _
-1, True, Nothing)
注解
此类已被弃用,不再受支持。 Microsoft Passport Network 已替换为 Windows Live ID。