Client Application Services - Part 1
page 5 of 7
by Bilal Haidar
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 57591/ 180

CLAS Classes

CLAS comes with several new classes that constitute the core functionality. We will list those classes and give a brief description of the use and importance of each one of them.

ClientFormsIdentity: When the user is about to be authenticated a call to the static Membership.ValidateUser method is issued to validate the credentials of the user. If Windows Authentication is configured in the application then this method always returns true. If however, Forms Authentication is configured, and if the user was successfully authenticated, an instance of the ClientFormsIdentity can be retrieved by casting the System.Threading.Thread.CurrentPrincipal.Identity to an instance of ClientFormsIdentity. Notice though when the application is configured with Windows Authentication, the System.Threading.Thread.CurrentPrincipal.Identity refers to an instance of System.Security.Principal.WindowsIdentity with the AuthenticationType property set to Kerberos. However, when the application is configured with Forms Authentication, an instance of the ClientFormsIdentity can be retrieved as mentioned above and the AuthenticationType property is set to ClientForms.

ClientRolePrincipal: Once the user is authenticated, an instance of the ClientRolePrincipal can be retrieved by casting the System.Threading.Thread.CurrentPrincipal object to an instance of ClientRolePrincipal object. This object provides information about the roles the currently authenticated user belongs to.

ConnectivityStatus: This class contains a single static property called IsOffline which allows you to switch the application from online mode to offline mode and vice versa.

ClientFormsAuthenticationCredentials: This class represents the credentials of a user. When you want to allow the user to enter his/her credentials to be authenticated, usually you would create a Login Windows Form that implements the IClientFormsAuthenticationCredentialsProvider interface. This interface contains a single method called GetCredentials and returns an instance of ClientFormsAuthenticationCredentials object containing the user’s credentials.

ClientFormsAuthenticationMembershipProvider: This class manages access to the remote authentication service for forms authentication. It extends the MembershipProvider and adds the Logout method and UserValidated event. Typically, when Forms Authentication is configured for the application, you can retrieve an instance of this class by casting the Membership.Provider property to an instance of ClientFormsAuthenticationMembershipProvider object.

ClientWindowsAuthenticationMembershipProvider: This class manages Windows Authentication. It extends Membership.Provider and adds a single method Logout. When the user is logged out, he or she will continue to be authenticated by Windows but unable to access the remote authentication services.

ClientRoleProvider: This class manages the access to the remote roles service. If your applications require accessing roles information for users, you can simply configure the Roles service the same as you configure Authentication service. As the other providers, the ClientRoleProvider contains the ServiceUri property that points to the address of the remote Role service. When a user is authenticated, you can retrieve an instance of the ClientRolePrincipal from the System.Threading.Thread.CurrentPrincipal object. This class contains the IsInRole method that internally calls the ClientRoleProvider.IsUserInRole method. One final note about the ClientRoleProvider, it is a Read-Only provider which means you can only use the ClientRoleProvider to retrieve a user’s roles information.

IClientFormsAuthenticationCredentialsProvider: This interface has been mentioned above when we discussed the ClientFormsAuthenticationCredentials class. This interface shall by implemented by the Windows Forms that will ask the user for credentials, fill up an instance of the ClientFormsAuthenticationCredentials object and send it back to the ValidateUser method whether called directly from the Membership class or from the ClientFormsAuthenticationMembershipProvider. Any class that implements this class shall provide a method called GetCredentials that returns an object of ClientFormsAuthenticationCredentials filled up with the entered user credentials.

At this point, we will be satisfied by only the above classes. In the next parts of this series we will introduce the other remaining classes and illustrate more the ones mentioned above.


View Entire Article

User Comments

Title: Mgr Appplication Development   
Name: Jothi
Date: 2008-12-30 11:28:42 AM
Comment:
Hi Bilal,
I would like to know if the same service can be used for multiple applications
Title: Client Application Services - Part 1   
Name: Safiyullah-India
Date: 2008-04-29 2:49:06 AM
Comment:
hi bilal... its good

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-05-26 5:26:58 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search