I need to set up an asp.net mvc website in which all user information is to be stored in mysql database and user authentication needs to implemented. The MySql database on located on a web hosting.
Till now, I have only relied on the default asp.net mvc project provided in visual studio and do not know much on how to setup membership and login functionality for a website.
Can anyone please advice where to start looking.
Thanks.
Here is a link with custom membership providers for MySql.
You will have to register them in Web.Config. Linked article explains well though.
When in doubt you can always refer to the sample Microsoft implementation. Their source is available here
I've done several sites with custom membership providers.
If you want to use something non-typical, like MySQL in .NET, I would suggest that you at least make it as much non-typical-part-agnostic as possible. In your example, that would be membership provider based on DB-agnostic data access, that is Entity Framework. Then you can even "switch" your underlying DB later without pain.
Look here :
http://efmembership.codeplex.com/
http://www.codeproject.com/KB/web-security/EFMembershipProvider.aspx
Related
This is not like other questions you might find similar. My issue is way bigger.
Scenario:
I have 3 websites. All of them have a common database for authentication and stuff.
Problem is that i will need to expand to 2 more sites, which means more maintenance in login screens and so on. So i will dedicate time to make a "central website" to manage users, access, etc.
Also, Need to implement OpenId for Microsoft Works accounts (ie, Azure tenants).
DDBB User Model: (Simplified)
All users are in the same central database. Which does not contains
anything non-user related.
User is personal on all applications.
Users can have different Roles
Each "User-Role" is mapped to an application, a server and a
database.
Problem:
Created a site in AspNet Core, without any authentication done so I can do it myself since I found that mapping Aspnet Identity tables was no-go because of incopatibilities and overriding is way to complicated, specially when dealing with Managers.
So, Tried and got working a simple Authentication page using HttpContext.Authentication.SignInAsync and CookieAuthentication. Which works well and there is no need to use any of the Identity's implementation (which is not compatible with my backend).
But then I added UseOpenIdConnectAuthentication to have the OpenId auth, but I have no idea how to use it since its suposed to work out of the box when using Identity and when checked documentation they use this code in an controller action: signInManager.ConfigureExternalAuthenticationProperties and I do not have any SignInManager since Im not using Aspnet Identity.
Questions:
Is coping the source of ConfigureExternalAuthenticationProperties to make it work in my site an aceptable solution?
Should I continue to override all SignInManager methods and also probably implement other classes to make Aspnet Identity work with my model?
Tried Mapping the properties to my columns just to test it out and it gave me non debuggable errors, which i dont like to even think about the problems this can give me in the future. For example one error was that it coudnt parse byte[] to string.
How can I implement Microsoft Work Accounts authentication and Database authentication in the same AspNet Site?
Bonus topic
Recently I feel like programming is becoming Configuring instead of coding. Is it just me? Are we now Professional Configurers?
Thanks
I am faced with a project that uses custom authentication via a WCF service that returns a set of claims based on some data identifying a user, close to user name and password. Then on top of this, I have a custom STS, derived from Microsoft.IdentityModel.SecurityTokenService, that resides in an ASP.NET web site project. This project looks like it was created with the VS2010 template, and not carefully had-crafted.
My gut feeling, and lots of on-line advice tell me that this web site STS project is very far from production ready. I am now looking for an MVC based STS that I can use in anticipation of being production ready. TinkTecture's IdentityServer looks promising, but it is so much more than simply implementing a custom derivation of SecurityTokenService, I have no idea where to start. If somebody could steer me toward an open project or walk-through that does this, or offer some guidance as to where and how I can start extending or modifying Identity Server, that would be great.
Have you looked at Thinktecture.IdentityServer v3? I'm at the moment using it and very simple to use.
It is still in Beta but RTM will be available soon. It has good documentation and samples too.
https://github.com/thinktecture/Thinktecture.IdentityServer.v3/wiki/Getting-started
https://github.com/thinktecture/Thinktecture.IdentityServer.v3/wiki
Update:
Identity Server 4 is also available. It supports cross-platform deployment with .NET Core.
https://github.com/IdentityServer/IdentityServer4/
Have you looked at the MSDN article by Michele Leroux Bustamante?
It's a little old and based on WCF, but it has code accompanying it.
Building A Custom Security Token Service
If you want ASP.NET based example, Microsoft published this:
ASP.NET Security Token Service Web Site
There's also this STS project on CodePlex.
I have an SQL Server database with a MVC 4 internet application. How do I use OAuth with my existing database and existing user table (unfortunately called 'Customer'). I'm trying to avoid changing as much as I can. Does anyone have any helpful information?
Take a look at DotNetOpenAuth. It's shipped with VS2012, is available via NuGet, and seems to be geared more toward the ASP.NET MVC audience than simpler WCF setups.
I started my project using ASP.NET SIMPLE MEMBERSHIP. Now I have the necessity to create a WPF application which can add users to SIMPLEM MEMBERSHIP tables.
In the ASP.NET, I've identified that this is the function to create new accounts:
WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
What would you suggest to implement this feature in a desktop application. I was thinking creating a WCF Web Service, but I don't know how difficult could be creating it.
You could use WCF but probably the simplest solution is to include the Asp.net Simple Membership Tables as part of an Entity Framework Model and use the model from within your WPF app. Check out this post for more details.
That would, of course, require direct access to your SQL Server and either a SQL Server account with access to the tables referenced from the EF model would have to be used or the app users would have to have access to the SQL Server through integrated security (if using mixed mode authentication with your SQL Server).
Why bother?
I would simply have yours users go to a link and register for an account online through an asp.net page. Once registered, offer the WPF/windows client as a download. This stuff is already pretty much all built-in.
That link might help: http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx
I'm doing project in asp.net mvc with Micorsoft Access database and I need to figure out how to make a login system and roles with Microsoft Access.
I have seen some examples on the web:
http://binarywater.com/OleDbASPNETMembershipProvider.html
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=404
I want to understand if they are examples that can be used in asp.nt mvc frmework 1.0 with 3.5.
Because the first link talks about asp.net 2.0 and also create the DataBase aspnetDB.mdb how do I use tables in my db?
You want to be one of your suggestions
Thanks again for your help
you have to write your custom MembershipProvider for your access database
or try to find one on the internet...
asp.net versions are different from the mvc versions
mvc framework 1 runs on .net 2.0 runtime....