I have deployed an instance of IdentityServer3 and now I need to customize their default implementation to use our existing user membership database and Simple Membership Provider.
By default, IdentityServer just takes a list of InMemoryUser objects and then just stores that list in memory variable. This, of course, never intended to work for any production implementation b/c you would want your users to be stored in the database and not in a hard-coded list.
Does anyone know what is the easiest way to make IdentityServer work with an existing ASP.NET Simple Membership database of users?
When you want to customize a certain part of IdSrv, implement the right interface and replace the default implementation with yours in repositories.config
file which is located in the WebSite
project.
In your particular case, you need custom IUserRepository
interface implementation, and I suspect you may (or may not) need 2 more interfaces as well - IUserManagementRepository
and IClaimsRepository
The IUserRepository
interface takes care of authentication:
public interface IUserRepository
{
bool ValidateUser(string userName, string password);
bool ValidateUser(X509Certificate2 clientCertificate, out string userName);
IEnumerable<string> GetRoles(string userName);
}
Here is an article that explains customization of IdentityServer: http://leastprivilege.com/2013/05/17/customizing-identityserver/
You could also search their website to check other pages relevant to IUserRepository
keyword, just copy this to Google Search:
IUserRepository site:leastprivilege.com
.
FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.
Boost your productivity with FavScripts.com!