AuthenticationService Class

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Provides a base class for services that authenticate, load, and save the current user.

Inheritance Hierarchy

System.Object
  System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationService
    System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService

Namespace:  System.ServiceModel.DomainServices.Client.ApplicationServices
Assembly:  System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)

Syntax

'Declaration
Public MustInherit Class AuthenticationService _
    Implements INotifyPropertyChanged
'Usage
Dim instance As AuthenticationService
public abstract class AuthenticationService : INotifyPropertyChanged
public ref class AuthenticationService abstract : INotifyPropertyChanged
[<AbstractClassAttribute>]
type AuthenticationService =  
    class
        interface INotifyPropertyChanged
    end
public abstract class AuthenticationService implements INotifyPropertyChanged

The AuthenticationService type exposes the following members.

Constructors

  Name Description
Protected method AuthenticationService Initializes a new instance of the AuthenticationService class.

Top

Properties

  Name Description
Public property IsBusy Gets a value indicating whether an asynchronous operation is in progress.
Public property IsLoadingUser Gets a value indicating whether an asynchronous LoadUser operation is in progress.
Public property IsLoggingIn Gets a value indicating whether an asynchronous Login operation is in progress.
Public property IsLoggingOut Gets a value indicating whether an asynchronous Logout operation is in progress.
Public property IsSavingUser Gets a value indicating whether an asynchronous SaveUser operation is in progress.
Protected property SupportsCancellation Gets a value indicating whether this authentication implementation supports cancellation.
Public property User Gets a principal representing the authenticated user.

Top

Methods

  Name Description
Protected method BeginLoadUser Begins an asynchronous LoadUser operation.
Protected method BeginLogin Begins an asynchronous Login operation.
Protected method BeginLogout Begins an asynchronous Logout operation.
Protected method BeginSaveUser Begins an asynchronous SaveUser operation.
Protected method CancelLoadUser Cancels an asynchronous LoadUser operation.
Protected method CancelLogin Cancels an asynchronous Login operation.
Protected method CancelLogout Cancels an asynchronous Logout operation.
Protected method CancelSaveUser Cancels an asynchronous SaveUser operation.
Protected method CreateDefaultUser Creates a default user.
Protected method EndLoadUser Ends an asynchronous LoadUser operation.
Protected method EndLogin Ends an asynchronous Login operation.
Protected method EndLogout Ends an asynchronous Logout operation.
Protected method EndSaveUser Ends an asynchronous SaveUser operation.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Public method LoadUser() Asynchronously loads the authenticated user from the server.
Public method LoadUser(Action<LoadUserOperation>, Object) Asynchronously loads the authenticated user from the server with specified callback method and user state.
Public method Login(LoginParameters) Asynchronously authenticates and logs in to the server with the specified parameters.
Public method Login(String, String) Asynchronously authenticates and logs in to the server with the specified user name and password.
Public method Login(LoginParameters, Action<LoginOperation>, Object) Asynchronously authenticates and logs in to the server with the specified parameters, callback method, and user state.
Public method Logout(Boolean) Asynchronously logs out an authenticated user from the server with the specified value indicating whether an exception is thrown for errors.
Public method Logout(Action<LogoutOperation>, Object) Asynchronously logs out an authenticated user from the server with the specified callback method and user state.
Protected method MemberwiseClone (Inherited from Object.)
Protected method OnPropertyChanged Raises a PropertyChanged event.
Protected method RaisePropertyChanged Raises a PropertyChanged event for the specified property.
Public method SaveUser(Boolean) Asynchronously saves the authenticated user to the server with the specified value indicating whether an exception is thrown for errors.
Public method SaveUser(Action<SaveUserOperation>, Object) Asynchronously saves the authenticated user to the server with the specified callback method and user state.
Public method ToString (Inherited from Object.)

Top

Events

  Name Description
Public event LoggedIn Occurs when a new user is successfully logged in.
Public event LoggedOut Occurs when a user is successfully logged out.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate event INotifyPropertyChanged.PropertyChanged Occurs every time a property value changes.

Top

Remarks

This abstract base class exposes Login, Logout, LoadUser, and SaveUser as asynchronous operations. It also provides a number of properties that can be bound to, including IsBusy and User.

Implementations of this class will have a much different view by using several abstract template methods. These methods follow the asynchronous result pattern and are presented in Begin/End pairs for each operation. Optionally, cancel methods for each operation can also be implemented.

For a complete example of implementing an authentication service, see Walkthrough: Using Authentication Service with Silverlight Navigation Application.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.ServiceModel.DomainServices.Client.ApplicationServices Namespace