none
Wanted: Internet Username Authentication Example RRS feed

  • Question

  • I've been reading WCFSecurityGuide.pdf at http://wcfsecurityguide.codeplex.com/ . They give fragments but not a complete working example that I can download, unzip and run in visual studio.

    I've been google/bing searching and cannot find one. Can someone point me to a complete example I can download and try out? I love those msdn examples at http://msdn.microsoft.com/en-us/library/vstudio/ms751450(v=vs.90).aspx . After unzipping those I did a search of those for 

    System.Web.Security.SqlMembershipProvider

    and could not find any matches. 

    Seems like something as useful and basic as this should be in high demand.

    Actually, there are two approaches discussed in this document. One uses transport security and the other uses message security. I'd love to have working examples of both.

    Thanks

    Siegfried


    siegfried heintze


    • Edited by siegfried_ Thursday, May 9, 2013 5:01 AM
    Thursday, May 9, 2013 4:57 AM

Answers

All replies

  • I usually go to www.msdn.com and then do a seartch for "code project" and the topic I'm looking for.  In your case I did the following

    code project transport message security

    I got lots of hits but this one looked interesting

    http://www.codeproject.com/Articles/18645/WCF-Transport-Layer-Security-using-wsHttpBinding-a


    jdweng

    Thursday, May 9, 2013 7:17 AM
  • I'm sorry. I was not clear enough.

    WCFSecurityGuide.pdf at http://wcfsecurityguide.codeplex.com/ describes these classes

    System.Web.Security.SqlRoleProvider

    System.Web.Security.SqlMembershipProvider

    Apparently these classes implement username authentication and authorization where the username and passwords are stored in SQL. I'm looking for examples that use these classes.

    I downloaded your example and found no references to these classes. I did another search and tried searching for "wcf security example code project". I found a lot of matches and tried http://www.codeproject.com/Articles/318810/WCF-Service-Method-Level-Security-using-Message-Co but this too did not contain either class. 

    http://wcfsecurityguide.codeplex.com provides code but it is just fragments. Can someone point me to a zip file example I can download that implements username/password security with SQL server and uses those class above?

    thanks

    Siegfried


    siegfried heintze

    Saturday, May 11, 2013 4:58 AM
  • Saturday, May 11, 2013 5:15 AM
  • Hi siegfried_,

    The WCF samples in .NET Framework sdk doesn't provide an example on using ASP.NET membership provider (for username authentication). But there is msdn reference providing information on how to configure membership provider for WCF username authentication (message security).


    #How to: Use the ASP.NET Membership Provider
    http://msdn.microsoft.com/en-us/library/ms731049.aspx


    and for the SQL membership provider's setup and configuration (at database and web.config file), it is not specific to WCF. As other members mentioned, you can refer to many online articles or screencast talking about how to setup/config SQL memership provider in ASP.NET web application (the same for WCF).


    #[How Do I:] Set Up the SQL Membership Provider
    http://www.asp.net/web-forms/videos/how-do-i/how-do-i-set-up-the-sql-membership-provider


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 15, 2013 3:42 AM
    Moderator
  • Since I see I posted this in the WCF forum (and not the ASP.NET or Silverlight forum), can I assume these links work equally well for 

    (1) ASP.NET

    (2) ASP.NET/MVC

    (3) ASP.NET Web API

    (4) WCF SOAP & REST accessed with AJAX

    (5) WCF Data Services (OData)

    (6) WCF RIA Silverlight Applications

    Thanks

    Siegfried


    siegfried heintze

    Thursday, May 16, 2013 2:18 AM
  • Hi siegfried,

    The following link I posted is specific to WCF programming (and using message layer security):

    #How to: Use the ASP.NET Membership Provider
    http://msdn.microsoft.com/en-us/library/ms731049.aspx

    And the other ASP.NET sql membership provider configuration link provided is suitable to most .NET applications that want to use the SQL membership provider.

    #[How Do I:] Set Up the SQL Membership Provider
    http://www.asp.net/web-forms/videos/how-do-i/how-do-i-set-up-the-sql-membership-provider

    Actually, the ASP.NET membership provider (also role providers) is introduced by ASP.NET web application development, they can be configured in standard .NET applications (like console, winform, WPF...) via app.config file. Here is a former blog entry talking about this.

    #Manage database of ASP.NET 2.0 Membership & Role services in non-ASP.NET context
    http://blogs.msdn.com/b/msdnts/archive/2006/12/16/asp-net-2-0-membership-role-management-out-of-asp-net-context.aspx

    But to use it with WCF + username authentication, we need to follow the WCF specific approach (configure it via service behavior and use with username authentication at message layer)


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 16, 2013 2:59 AM
    Moderator
  • But to use it with WCF + username authentication, we need to follow the WCF specific approach (configure it via service behavior and use with username authentication at message layer)

    Can someone elaborate on this? Specifically, can I use the SQLMembership and Role providers with WCF RIA, WCF OData and plain old WCF? I'm still reading all those links (sorry I'm so slow). So far, however, they look like they are ASP.NET specific. So how would I implement username authentication/authorization for these other cases? I'm hoping someone can point me to some working examples that store usernames/passwords in a SQL Server table.

    Thanks

    Siegfried


    siegfried heintze


    • Edited by siegfried_ Friday, May 17, 2013 10:21 PM
    Friday, May 17, 2013 4:50 PM