Authentication Task and Object Mapping from COM to .NET

The AuthManager object and the AuthFilter ISAPI filter contained most of the Authentication system functionality in Commerce Server ASP-based sites. Both the AuthManager object and the AuthFilter ISAPI filter are available in the Commerce Server 2002 .NET Application Framework; however, the functionality of the AuthManager object has been split into four types: AuthManager, AuthenticationInfo, AuthTicket, and ProfileTicket.

Outside of the Commerce Server .NET Application Framework, the .NET Application Framework also has built-in support for forms-based and passport-based authentication. These methods can be used instead of the Commerce Server objects, but they do have some limitations. For more information about forms-based and passport-based authentication, see the .NET Framework SDK documentation.

Object mapping

The .NET types in the following table are in the Microsoft.CommerceServer.Runtime namespace unless otherwise noted.

ASP ASP.NET
AuthManager AuthManager

AuthenticationInfo

AuthTicket

ProfileTicket

AuthFilter ISAPI AuthFilter ISAPI

Task mapping

For each task on an ASP page, you must instantiate a new instance of the AuthManager COM component and initialize it with a site name, then make a call to the method listed in the ASP column of the tables listed below. When completing the task from an ASP.NET page, if the Commerce Authentication Module is enabled in the web.config file, reference the CommerceContext.Current.AuthenticationInfo class on the page and call the method listed in the ASP.NET column of the table. If the Commerce Authentication Module is not enabled in the web.config file, instantiate a new instance of the AuthManager object and initialize it a with a site name, and then call the method listed in the ASP.NET column of the table.

Setting a new AuthTicket

Setting a new ProfileTicket

Checking if the incoming request has a valid AuthTicket

Generating an encryption key

Getting the User ID from a cookie

Getting the User ID from a cookie and key

Refreshing the AuthTicket

Adding, removing, modifying, or retrieving a custom property from the AuthTicket

Modifying or retrieving the User ID from the AuthTicket

Adding, removing, modifying, or retrieving a custom property from the ProfileTicket

Modifying or retrieving the User ID from the ProfileTicket

Removing the AuthTicket from the outgoing response

Constructing a URL or URL QueryString that includes an AuthTicket or ProfileTicket

Setting a new AuthTicket

ASP ASP.NET
AuthManager.SetAuthTicket If the Commerce Authentication Module is enabled, use:

CommerceContext.Current.AuthenticationInfo.SetAuthTicket

If the Commerce Authentication Module is not enabled, use:

AuthManager.SetAuthTicket

Setting a new ProfileTicket

ASP ASP.NET
AuthManager.SetProfileTicket If the Commerce Authentication Module is enabled, use:

CommerceContext.Current.AuthenticationInfo. SetProfileTicket

If the Commerce Authentication Module is not enabled, use:

AuthManager.SetProfileTicket

Checking if the incoming request has a valid AuthTicket

ASP ASP.NET
AuthManager.IsAuthenticated If the Commerce Authentication Module is enabled, reference the CommerceContext.Current.AuthenticationInfo class, and then call:

CommercContext.Current.AuthenticationInfo. IsAuthenticated

If the Commerce Authentication Module is not enabled, use:

AuthManager. IsAuthenticated

Generating an encryption key

ASP ASP.NET
AuthManager.GenerateEncryptionKey If the Commerce Authentication Module is enabled, use:

CommerceContext.Current.AuthenticationInfo. GenerateEncryptionKey

If the Commerce Authentication Module is not enabled, use:

AuthManager.GenerateEncryptionKey

ASP ASP.NET
AuthManager.GetUserIDFromCookie If the Commerce Authentication Module is enabled, use:

CommerceContext.Current.AuthenticationInfo. GetUserIDFromCookie

If the Commerce Authentication Module is not enabled, use:

AuthManager.GetUserIDFromCookie

ASP ASP.NET
AuthManager.GetUserIDFromCookieAndKey If the Commerce Authentication Module is enabled, use:

CommercContext.Current.AuthenticationInfo. GetUserIDFromCookieAndKey

If the Commerce Authentication Module is not enabled, use:

AuthManager.GetUserIDFromCookieAndKey

Refreshing the AuthTicket

ASP ASP.NET
AuthManager.Refresh If the Commerce Authentication Module is enabled, use:

CommerceContext.Current.AuthenticationInfo.Refresh

If the Commerce Authentication Module is not enabled, use:

AuthManager.Refresh

Adding, removing, modifying, or retrieving a custom property from the AuthTicket

ASP ASP.NET
AuthManager.SetProperty

AuthManager.GetProperty

If the Commerce Authentication Module is enabled, follow the instructions given in the Task Mapping topic, then reference the AuthTicket object, and then call:

CommerceContext.Current.AuthenticationInfo. AuthTicket.Item

If the Commerce Authentication Module has not been enabled, instantiate a new instance of the AuthManager class and initialize it with a site name. Then reference the AuthTicket object and then call:

AuthManager.AuthTicket.Item

Modifying or retrieving the User ID from the AuthTicket

ASP ASP.NET
AuthManager.SetUserID

AuthManager.GetUserID

If the Commerce Authentication Module is enabled, follow the instructions given in the Task Mapping topic, then reference the AuthTicket object, and then call:

CommerceContext.Current.AuthenticationInfo. AuthTicket.UserID

If the Commerce Authentication Module has not been enabled, instantiate a new instance of the AuthManager class and initialize it with a site name. Then reference the AuthTicket object, and then call:

AuthManager.AuthTicket.UserID

Adding, removing, modifying, or retrieving a custom property from the ProfileTicket

ASP ASP.NET
AuthManager.SetProperty

AuthManager.GetProperty

If the Commerce Authentication Module is enabled, follow the instructions given in the Task Mapping topic, then reference the ProfileTicket object, and then call:

CommerceContext.Current.AuthenticationInfo. ProfileTicket.Item

If the Commerce Authentication Module has not been enabled, instantiate a new instance of the AuthManager object and initialize it with a site name. Then reference the ProfileTicket object, and then call:

AuthManager.ProfileTicket.Item

Modifying or retrieving the User ID from the ProfileTicket

ASP ASP.NET
AuthManager.SetUserID

AuthManager.GetUserID

If the Commerce Authentication Module is enabled, follow the instructions given in the Task Mapping topic, then reference the ProfileTicket object, and then call:

CommerceContext.Current.AuthenticationInfo. ProfileTicket.UserID

If the Commerce Authentication Module has not been enabled, instantiate a new instance of the AuthManager object and initialize it with a site name. Then reference the ProfileTicket object, and then call:

AuthManager.ProfileTicket.UserID

Removing the AuthTicket from the outgoing response

ASP ASP.NET
AuthManager.SetAuthTicket(“”, TRUE, 90) If the Commerce Authentication Module is enabled, use:

CommerceContext.Current.AuthenticationInfo.AuthTicket.SignOut

If the Commerce Authentication Module is not enabled, instantiate a new instance of the AuthManager object and initialize it with a site name. Then reference the AuthTicket object on the AuthManager instance, and then call:

AuthManager.AuthTicket.SignOut

Constructing a URL or URL QueryString that includes an AuthTicket or ProfileTicket

Using an AuthTicket or ProfileTicket in a URL is useful for supporting cookieless mode authenticaiton sessions.

ASP ASP.NET
AuthManager.GetURL

AuthManager.URLArgs

AuthManager.URLShopperArgs

If the Commerce Authentication Module has to be enabled, reference the CommerceContext.Current.QueryStringBuilder object, and then call:

CommerceContext.Current.QueryStringBuilder.BuildURL

Copyright © 2005 Microsoft Corporation.
All rights reserved.