Welcome Guest, you are in: Login

WCF RIA Services Wiki

RSS RSS

Navigation





Search the wiki
»

PoweredBy

Page History: Windows Authentication with WCF RIA Services

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Tuesday, 13 April 2010 08:18 AM


I followed the instructions outlined at the following blog post: http://www.dansoltesz.com/post/2010/01/26/WCF-Ria-Services-Active-Directory-Roles.aspx and I received a SQL exception that suggests that the service is still trying to hit a SQL repository to retrieve the user information. To work around this, I added the following to the AuthenticationService implementation:

/// /// Gets details of the authenticated user. /// /// /// The principal. /// /// /// A populated instance of the User class. /// protected override User GetAuthenticatedUser(IPrincipal principal) { return User.CreateFromPrincipal(principal); }

And added this to the User class:

/// /// Creates a User instance from the supplied IPrincipal. /// /// /// The principal. /// /// /// A populated instance of the User class. /// public static User CreateFromPrincipal(IPrincipal principal) { return new User { FriendlyName = principal.Identity.Name, Name = principal.Identity.Name, Roles = System.Web.Security.Roles.GetRolesForUser(principal.Identity.Name) }; }

ScrewTurn Wiki version 3.0.2.509. Some of the icons created by FamFamFam.