WindowsAuthentication 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 an authentication service implementation that performs Windows authentication using a DomainContext generated from a domain service implementing the IAuthentication<T> interface.
Inheritance Hierarchy
System.Object
System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationService
System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService
System.ServiceModel.DomainServices.Client.ApplicationServices.WindowsAuthentication
Namespace: System.ServiceModel.DomainServices.Client.ApplicationServices
Assembly: System.ServiceModel.DomainServices.Client.Web (in System.ServiceModel.DomainServices.Client.Web.dll)
Syntax
'Declaration
Public Class WindowsAuthentication _
Inherits WebAuthenticationService
'Usage
Dim instance As WindowsAuthentication
public class WindowsAuthentication : WebAuthenticationService
public ref class WindowsAuthentication : public WebAuthenticationService
type WindowsAuthentication =
class
inherit WebAuthenticationService
end
public class WindowsAuthentication extends WebAuthenticationService
The WindowsAuthentication type exposes the following members.
Constructors
Name | Description | |
---|---|---|
WindowsAuthentication | Initializes a new instance of the WindowsAuthentication class. |
Top
Properties
Name | Description | |
---|---|---|
DomainContext | Gets or sets the domain context this service delegates authenticating, loading, and saving to. (Inherited from WebAuthenticationService.) | |
DomainContextType | Gets or sets the type of the domain context. (Inherited from WebAuthenticationService.) | |
IsBusy | Gets a value indicating whether an asynchronous operation is in progress. (Inherited from AuthenticationService.) | |
IsLoadingUser | Gets a value indicating whether an asynchronous LoadUser operation is in progress. (Inherited from AuthenticationService.) | |
IsLoggingIn | Gets a value indicating whether an asynchronous Login operation is in progress. (Inherited from AuthenticationService.) | |
IsLoggingOut | Gets a value indicating whether an asynchronous Logout operation is in progress. (Inherited from AuthenticationService.) | |
IsSavingUser | Gets a value indicating whether an asynchronous SaveUser operation is in progress. (Inherited from AuthenticationService.) | |
SupportsCancellation | Gets a value that indicates whether this service supports cancellation. (Inherited from WebAuthenticationService.) | |
User | Gets a principal representing the authenticated user. (Inherited from AuthenticationService.) |
Top
Methods
Name | Description | |
---|---|---|
BeginLoadUser | Begins an asynchronous LoadUser operation. (Inherited from WebAuthenticationService.) | |
BeginLogin | Login is not a supported operation for Windows authentication. (Overrides WebAuthenticationService.BeginLogin(LoginParameters, AsyncCallback, Object).) | |
BeginLogout | Logout is not a supported operation for Windows authentication. (Overrides WebAuthenticationService.BeginLogout(AsyncCallback, Object).) | |
BeginSaveUser | Begins an asynchronous SaveUser operation. (Inherited from WebAuthenticationService.) | |
CancelLoadUser | Cancels an asynchronous LoadUser operation. (Inherited from WebAuthenticationService.) | |
CancelLogin | Cancels an asynchronous Login operation. (Inherited from WebAuthenticationService.) | |
CancelLogout | Cancels an asynchronous Logout operation. (Inherited from WebAuthenticationService.) | |
CancelSaveUser | Cancels an asynchronous SaveUser operation. (Inherited from WebAuthenticationService.) | |
CreateDefaultUser | Creates a default user. (Inherited from WebAuthenticationService.) | |
EndLoadUser | Ends an asynchronous LoadUser operation. (Inherited from WebAuthenticationService.) | |
EndLogin | Ends an asynchronous Login operation. (Inherited from WebAuthenticationService.) | |
EndLogout | Ends an asynchronous Logout operation. (Inherited from WebAuthenticationService.) | |
EndSaveUser | Ends an asynchronous SaveUser operation. (Inherited from WebAuthenticationService.) | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
Initialize | Initializes this authentication service. (Inherited from WebAuthenticationService.) | |
LoadUser() | Asynchronously loads the authenticated user from the server. (Inherited from AuthenticationService.) | |
LoadUser(Action<LoadUserOperation>, Object) | Asynchronously loads the authenticated user from the server with specified callback method and user state. (Inherited from AuthenticationService.) | |
Login(LoginParameters) | Asynchronously authenticates and logs in to the server with the specified parameters. (Inherited from AuthenticationService.) | |
Login(String, String) | Asynchronously authenticates and logs in to the server with the specified user name and password. (Inherited from AuthenticationService.) | |
Login(LoginParameters, Action<LoginOperation>, Object) | Asynchronously authenticates and logs in to the server with the specified parameters, callback method, and user state. (Inherited from AuthenticationService.) | |
Logout(Boolean) | Asynchronously logs out an authenticated user from the server with the specified value indicating whether an exception is thrown for errors. (Inherited from AuthenticationService.) | |
Logout(Action<LogoutOperation>, Object) | Asynchronously logs out an authenticated user from the server with the specified callback method and user state. (Inherited from AuthenticationService.) | |
MemberwiseClone | (Inherited from Object.) | |
OnPropertyChanged | Raises a PropertyChanged event. (Inherited from AuthenticationService.) | |
RaisePropertyChanged | Raises a PropertyChanged event for the specified property. (Inherited from AuthenticationService.) | |
SaveUser(Boolean) | Asynchronously saves the authenticated user to the server with the specified value indicating whether an exception is thrown for errors. (Inherited from AuthenticationService.) | |
SaveUser(Action<SaveUserOperation>, Object) | Asynchronously saves the authenticated user to the server with the specified callback method and user state. (Inherited from AuthenticationService.) | |
ToString | (Inherited from Object.) |
Top
Events
Name | Description | |
---|---|---|
LoggedIn | Occurs when a new user is successfully logged in. (Inherited from AuthenticationService.) | |
LoggedOut | Occurs when a user is successfully logged out. (Inherited from AuthenticationService.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
INotifyPropertyChanged.PropertyChanged | Occurs every time a property value changes. (Inherited from AuthenticationService.) |
Top
Remarks
To configure your application to use Windows authentication, you must set values in both the server and client project. You use the WindowsAuthentication class when setting the value in the client project.
In the Web.config file of the server project, set the authentication mode to “Windows”, as shown in the following example.
<system.web>
<authentication mode="Windows"></authentication>
</system.web>
In the constructor of the Application object for the client application, set the Authentication property of the WebContext object to WindowsAuthentication, as shown in the following example. The constructor is typically in a file named App.xaml.cs or App.xaml.vb.
Public Sub New()
InitializeComponent()
Dim webContext As New WebContext()
'webContext.Authentication = New FormsAuthentication()
webContext.Authentication = New WindowsAuthentication()
Me.ApplicationLifetimeObjects.Add(webContext)
End Sub
public App()
{
InitializeComponent();
WebContext webContext = new WebContext();
//webContext.Authentication = new FormsAuthentication();
webContext.Authentication = new WindowsAuthentication();
this.ApplicationLifetimeObjects.Add(webContext);
}
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