Manager.IsAuthenticated
Manager.IsAuthenticated
The IsAuthenticated method returns a value indicating whether the user is authenticated against a Microsoft® .NET Passport authority based on the TimeWindow and the ForceLogin parameters.
Syntax
Function Manager.IsAuthenticated ([TimeWindow], [ForceLogin], [SecureLevel]) As Boolean
Parameters
- TimeWindow
Optional integer specifying the maximum allowed time since the user's last sign-in to the calling domain. Pass -1 to indicate that .NET Passport should use the default value. The value entered for TimeWindow must be -1, or greater than or equal to 20, and less than 2678400 (between 20 seconds and 31 days).
- ForceLogin
Optional Boolean. If set to True, users must have signed in within the TimeWindow interval. If set to False, users may have signed in using the silent refresh or manual sign-in.
- SecureLevel
Optional integer used to determine if a sign-in is from a Secure Sockets Layer (SSL) sign-in.
Return values
The IsAuthenticated method returns a Boolean value. The value is True if the user has a valid, unexpired .NET Passport Ticket cookie in the caller's domain or has a fresh Ticket on the query string; otherwise, the value is False.
Example
The following Microsoft Visual Basic Scripting Edition (VBScript) code snippet uses the IsAuthenticated method without any optional parameters to determine if the user has signed in within the default TimeWindow. If the user is authenticated, the example displays the default TimeWindow and displays a warning based upon the default ForceSignIn parameter. The code then sets the TimeWindow, ForceLogin, and SecureLevel parameters and again calls the IsAuthenticated method.
... Dim oMgr Set oMgr = Server.CreateObject("Passport.Manager") TimeWindow = oMgr.GetCurrentConfig("TimeWindow") ForceLogin = oMgr.GetCurrentConfig("ForceSignIn") Response.Write ("<br>" & oMgr.Profile("firstName") & ", you have been authenticated.") Response.Write ("<br> You signed in " & oMgr.TimeSinceSignIn & " seconds ago, which was within the default TimeWindow of " & TimeWindow & " seconds.") If ForceLogin Then Response.Write ("<br>You were forced to sign in using your password.") Else Response.Write ("<br>You might have done a silent sign-in.") End If 'End If ForceLogin 'Set the parameters for the IsAuthenticated call. TimeWindow = 60 ForceLogin = True SecureLevel = 0 'Check for IsAuthenticated, using the defined parameters. If oMgr.IsAuthenticated(TimeWindow,ForceLogin,SecureLevel) Then Response.Write ("<br>You have authenticated with your password within the TimeWindow of " & TimeWindow & " seconds.") Else Response.Write ("<br>You have a stale ticket. A fresh sign-in is warranted.") End If 'End If IsAuthenticated(TimeWindow,ForceLogin,SecureLevel) ...
Remarks
The IsAuthenticated method returns a Boolean value indicating the presence of a valid .NET Passport Ticket cookie in the caller's domain or a fresh Ticket on the query string.
If the optional TimeWindow parameter is omitted, the default specified in the registry is used. Use the Passport Manager Administration utility to set the default TimeWindow.
If the optional ForceLogin parameter is omitted, the default specified in the registry is used. Use the Passport Manager Administration utility to set the default ForceLogin.
If the optional SecureLevel parameter is omitted, the default value of 0 is used. SecureLevel can be set to the following values:
SecureLevel value Description 0 (or unspecified) Any type of sign-in is acceptable if it agrees with the TimeWindow or ForceLogin specified in the call. 10 Specifying 10 for SecureLevel requires that sign-in must occur over a secure channel and according to the TimeWindow and/or ForceLogin supplied in the call. 100 Specifying 100 for SecureLevel requires that sign-in must occur over a secure channel, and with a security key in addition to password, and also according to the TimeWindow and/or ForceLogin supplied in the call.
See Also