Silverlight RIA Services - how to do Windows Authentication?

99封情书 提交于 2019-12-03 03:40:01

In order to do this you will have to write your own Profile Provider and then modify the user class to include these profile properties which you can then access.

Have a look at page Section 13.3 of the RIA Services Overview document and let me know if you need any help.

We are just in the middle of implementing a RIA Services application and have written our own custom membership provide and profile provider so let me know if you need a hand.

Hey everybody, there's a new article up on MSDN, I'm working through it now.

http://msdn.microsoft.com/en-us/library/ee707353(VS.91).aspx

Premk

Here is how I have hacked it on the AuthenticationService provided by BusinessApplicationTemplate.

 [EnableClientAccess]
    public class AuthenticationService : AuthenticationBase<User> {

    protected override User  GetAuthenticatedUser(System.Security.Principal.IPrincipal principal)
    {
        User user = base.GetAuthenticatedUser(principal);
        Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
        SystemWebSectionGroup grp = (SystemWebSectionGroup)config.GetSectionGroup("system.web");
        AuthenticationSection auth = grp.Authentication;
        if (auth.Mode == AuthenticationMode.Forms)
        {
        }
        else if (auth.Mode == AuthenticationMode.Windows)
        {
            string[] a = user.Name.Split('\\');
            System.DirectoryServices.DirectoryEntry ADEntry = new System.DirectoryServices.DirectoryEntry("WinNT://" + a[0] + "/" + a[1]);
            string Name = ADEntry.Properties["FullName"].Value.ToString();
            user.Name = Name;
        }
        return user;
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!