YAFLogo

Posted by: Delirium - Thursday, 12 September 2013 16:29:43
Hi guys, first of all: yaf is great and I have a live forum running for years now. I still can count the times I needed to spend time to do some maintainence on it with one hand. Awesome! For a new Project I am now struggeling on something which seems to be a bit of a bigger problem. I am using ASP.NET MVC4 (razor) with Simplemembership and Simpleroles. Data is stored on SQL Server 2008 R2 Express (will be full SQL Server on live site) and data access is made with Entity Framework 5 (which is quite cool). I want to integrate YAF into my site, which is a bit of a pain. First I had a look at the sample Integration application, but it's not MVC so it does not help at all. So - what are other plans of (pseudo)integrating? I came up with the following Ideas and I'm wondering if they are any good. 1. Synchronizing Tables The basic Idea is that Username and Password (and Avatars for that reason) are managed by my app and are only changed by my app. Changes made to my Database would be done to the YAF.NET Database too. I don't like that Idea too much because it has several obvious drawbacks - e.g. I have to find a way to ensure data is consistant and this solution does not provide SSO. 2. Let YAF use Simplemembership directly I tried this one and got stuck with the Database not initialized error. I still did not figured out a good place to do this initialization. After All, it's a one-liner that should do the trick. But even if this does work, I am not sure if it will also do correctly with the SimpleRoleProvider - but this sould be working with the least amount of modifying the YAF sources directly. If you can point out a nice place to do this initializing thing (it must be called on every request) I would greatly appreciate this. 3. Let my App use YAF Memebership I think this would be an easy one, I just have to swap out Simplemembership and swap in YAF Membership, but to do this I would have to heavvily alter my Database layout and rework nearly all FK Constraints. There has to be another way. 4. Reworking YAFs Membership Provider This would include rewriting all the crypto stuff from scratch to do something reasonable and supporting modern password cryptography such as PBKDF2SHA1/256/512. Also I'd need to rework the stored procedures to use my custom Users table. Did I miss something? In the yaf sources I grabbed from github (I still don't get the github hype btw) I found a Membership Passthrough Provider, but using this still does not eliminate the need of calling the Database initialization. Any help woud be greatly appreciated.

Posted by: Jaben - Saturday, 14 September 2013 22:06:02
Happy YAF.NET is working well for you! My support forum doesn't even use YAF Providers -- it uses custom bespoke providers against an e-commerce platform I wrote. My recommendation is just use your providers, yes. As far as per request initialization, YAF.NET is just ASP.NET -- put that code in a Global.asax.cs file on "Begin Request". More information here: http://stackoverflow.com/questions/6590578/how-do-you-wire-up-application-beginrequest-in-asp-net-mvc But honestly, sounds like a bit of the code smell... the providers should only create a DB connection when it first needs one. You may want to revisit that code.

Posted by: Delirium - Saturday, 14 September 2013 22:30:00
Thanks for your input! The Initialization code just tells the provider which Tables and Columns to use for basic user data. It's a bit of dirty hack around ASP.NET Membership as the whole system tends to get very bloated as soon as you have a database layout that does not fit the standards. I will investigate this a bit more and post again wether I was successful or not.

Posted by: HeadFried - Monday, 16 September 2013 14:08:11
I am also very interested in this topic. We have downloaded and tested the YAF and the software does exactly what we want, we would be happy to use it. Our problem is that we are also building an MVC 4 application that requires a login and members page. We have built custom logins on our previous MVC apps so are unsure how to use the YAF tables in order to secure our new application. If possible can someone provide the steps involved in authenticating a user? What should our post controller look like after receiving the user login details? How can we use the forum roles in our custom application? Thanks for the help

Posted by: HeadFried - Friday, 6 December 2013 17:46:02
Any help on this would be appreciated. thanks