I am developing a SAAS using MVC 3 .net.
I will have a public database which when someone tries to login it will determine what company the user is logging in from and get the company ID.
It will then access the database using the schema assigned to that company and see if that user is valid.
I want to know would it be better to have a fixed connection string to my public database and individual database connections for each tenant for the multi-tenant database (database would have a one database with shared schema).
My suggestion is to create username and password for each teneant database and save these credentials in the relative users/customer table in public database.
Public database can have a separate connection string which is only used when tenants need to access shared/private information stored in there.
You may create multiple replica of public/shared database to increase performance between tenants. additionally you can sit with your db admin from scaling point of view for managing connections between tenants, auto closing etc. hope this helps
Related
I have a requirement where I have a Client application i.e (MVC Application) and Identity Server 4 application where I need to authenticate the users from MVC application.
Now I am able to authenticate the In Memory static users as well as AspNetIdentity users with Identity Server 4.
But how can I use my custom database with Identity Server 4 to authenticate users.
e.g I have a table with following columns:
UserName, Password, Role, IsActive
I want to authenticate the users from this table with Identity Server 4.
Please help me out with this.
Thanks,
Naveen
It is pretty much up to you how you do it. Your controllers responsible for handling the login interactions need to have the required dependencies injected into their instances. So you can imagine injecting your own IUserService, or IUserRepository, or IUserStore to do this. And then you can implement an IProfileService based off those interfaces as well.
My client requirement is to implement application as same application with different database as Multi Tenant application.
As per requirement, different user can access same application but as per user identity he will be connecting to different database to access company specific details. each company has different database.
I would be planning this with Asp.Net MVC, EntitiyFramework with database first (as database already exist) but I am not sure will able to handle this as multitenant app. Can you please guide or give me any direction or sample if already implemented.
Thanks
Nik
I have a question regarding password protection to a table I created when I developed my database using Open Office.
I want to know how can I make a single table as password protected?
eg,
I have a database named Data
I created a table named Data-table
How can I provide a password protection on this table in open office?
In any database, access permissions are granted to specific database users. So in the initial OpenOffice Base connection setup you need to choose a specific user. (If you do not choose a specific user, the default is the SA account which has rights to all tables.)
To grant access, you need to execute a GRANT statement for that user. Examples using mysql are given at http://dev.mysql.com/doc/refman/5.7/en/grant.html:
GRANT ALL ON db1.table1 TO 'jeffrey'#'localhost';
If you are using the default HSQLDB engine with both the client and database in a single file, then in order to connect as a specific user, I think you need to convert it to a more powerful client/server setup.
To do this, you can either unzip the .odb file and extract the HSQLDB files (see here), or copy the data into a mysql database or other database of your choice. Once the data is in a separate database, it should not be hard to do what you are asking.
Consider the next scenario:
I have created an ASP.NET MVC 5 Web Application for a very simple project. The database is hosted on Azure. I have a separated project to handle the database operations. Now I want to use the Identity Framework to manage the security and authorization. In the most articles I have read there is a common solution:
Go to the ApplicationDbContext class
Change the "DefaultConnection" string by my own connection string ("SurveysEntities" in my case).
Compile and enjoy.
But in my case I am having the following exception after trying to create a new user:
The entity type ApplicationUser is not part of the model for the
current context
Considerations:
I have used the "database first" approach.
My database is hosted on Azure.
I have repplicated the database tables created on a local enviroment (localdb) but the problem persists
What is the problem?
Fix this by creating a standard connection string that pointed to the database where the ASP.NET Identity tables are (in my case the same database), used that connection string in :base.
so I'm developing a SAAS application using asp.net mvc SQL server 2008 and Linq2SQL I've a master db where I'll store information about clients like name subdomain/hostname information and other stuff and I'll use one database per client for the actual client data,
what is the best way to generate and use the connection string for each individual db the connection string will be based on each customer domain so I could hard code it into master db at customer creation and create the DataContext based on that? any flaws in this strategy?
I am also using forms authentication and it will be built into each clients own db so do I've add anything dynamically to the configuration? as currently the authentication/membership is driven by connection string inside the web.config file
You should probably have a table in a centralized master db that includes the database connection information for each client. Then in your SAAS application, any time you are instantiating the data context, instead of using the default parameterless constructor, use the constructor overload that takes the connection string you stored in the centralized database for that client. The context shouldn't be kept alive between requests, so you shouldn't have a problem with cross page requests across multiple clients.