Implement new IdentityServer in .NetCore MVC with existing UserDb - c#

I would like to create a new IdentityServer4 for a .NetCore MVC Project without ASP-Authentication, which gets the users from an existing MS SQL-database.
The user database should not have to be changed, if not necessary.
Unfortunately, previous tutorials could not help me, because a lot has been revised.
What steps are necessary to achieve this?
Hope you can help me,
best regards

The Identity server i am currently working on used to connect to a MsSQL server database that contained legacy users. The identity server itself stored its own tables in its database. I believe the way it worked was it had its on UserDbContext added to the middelwere.
So what we had was.
Identity server database - clients and stuff
Legacy user database - All user data.
Which is close to what you are talking about
services.AddDbContext<UserDbContext>(builder => builder.UseSqlServer(settingsSetup.ConnectionStrings.UserDatabaseConnection));
Everything ran though a custom UserManager.
It no longer runs this way as over the summer i integrated all of the users to Asp .net core identity and the data now resides in the same database as the identity server.
I can dig around in the solution control old branches if you need more info.

Related

EntityFrameworkCore - It is possible to configure a unique database for each user?

My client asked to build an API in ASP NET Core for a business management application. Nonetheless, he made me an unusual requirement for me: He needs each user to have their own database. All databases have the same structure of tables and relationships and all are MySql.
This means that each user will need their own connection string and some way to store that information.
In addition, other users will be added in the future, each with a bank created just for their use.
Anyway, I don't know if this is possible, but if it is, how would I do it?

MVC connecting to server database

I am rebuilding a number of report applications. The application connects to a core system database to display data.
The current report uses a trusted connection string to the core system.
I am new to MVC and wondering how I can make the connection because I do not have (and cannot obtain) the login details for this database. Therefore how do I reference this as nearly all the forums I’ve looked at, use entity framework which prompts a login.
Any help would be great.
Cheers.

How to put database on azure website

I recently finished my asp website, bought the domain and azure hosting. Unfortunately, when I try to do anything that accesses the database I just get stuck on a loading screen. I just used the default asp razor mvc 5 project I think for the database along with a couple of custom tables.
So here is how I would do it since you have an existing database. I would follow azures website, and set up a SQL database. I would then script out the database on you local machine, and log into your azure database using SQL Server Express. Execute the script you generated from localDB. Then all of your data will be good to go. You will then need to take the connection string from azure, and put it in your applications config file. After modifying the connection string in your application you should redeploy, and verify everything is working the way you want. You will be able to verify your data is there in SQL Server Express.
Here is a link that may be of quite a bit of assistance to you. It includes step by step instructions as well as screen shots.
Another option is using this tool. I have never used it, but I know a few people who have had great success with it.

Connecting asp.net Identity to SQL Azure

It seems MVC 5 no longer uses simple membership and I am having trouble figuring out how to use a SQL Azure database instead of the default .mdf file that is generated and saved on the web server. In simple membership it was as easy as changing two connection strings but that does not seem to be the case here. From what I have found online, it seems like I have to create my own custom storage provider to accomplish such a simple task. The only examples and docs I find online that deal with Azure are scenarios in which the developer wants to store in a non-relational setup or Azure Table storage.
Am I right in the above conclusion or is there something I am missing about integrating SQL Azure DB into my MVC 5 Asp.Net Identity app?
I have Identity running on top of a SQL Azure DB in one of my projects. You don't need to implement your own storage provider. The only thing you have to do is to change the connection string (normally named DefaultConnection) in your web.config file and point it to your SQL Azure DB.

Creating ASP.NET website with membership database in server

I am trying to find out how I can add the membership database to my Mircroft SQL Server and then be able to reference it from a ASP.NET application. Basically, I created a new website app project, how do I create the asp_net membership database and then tell my website to comunicate to it?, I found this
http://msdn.microsoft.com/en-us/library/879kf95c.aspx
But that is not what i want, it creates a database file in the App_Code folder, I want it to access my Microsoft SQL Server and then there have such database. I am new to this setting up login merbership stuff and some pointers would be of great help. I thought maybe there was like a wizard where you could specify the server etc..?
Regards
There is a really nice Walkthrough of that here. You just need to use aspnet_regsql.exe to create the necessary objects in SQL Server and use Membership provider settings to use this new connection string, it is explained here under the Step 4: Specifying the Provider and Customizing Its Settings.
Hope that helps.
Cheers

Categories

Resources