First of all, ASP.NET Core doesn't have support for
Membership anymore, you would have to use
I recently came across such requirement myself as our applications were growing and, each time, we had to implement membership/identity for each of them.
The solution i came up with was to build a centralized authentication server which will accept user credentials, connect to database, authenticate the credentials and generate/return tokens (
JWT). This token will serve the purpose of both authentication and authorization through claims. Only this application/server will implement identity.
On any client application with protected resources (
Authorize), they would have to implement a middleware which will read the token and validate the claims. There is no requirement for the middleware to connect to the database again to validate the claims. This token will be appended to the
Authorization header every time a request is made to a protected resource.
Every time you create a new application which will use the same authentication server, all you need to do is to implement/inject the validation middleware. There is no need to re-implement identity again.
Refer below resources for basics & implementation details.
Additional Resources once you are through with the basics:
Note: In my scenario, all applications interact with the same database.