Identityserver4: Using MongoDB as User Store and Configuration Store

Created on 3 May 2018  路  4Comments  路  Source: IdentityServer/IdentityServer4

I am converting my configuration store and user store from MSSQL to Mongo.

First of all, I converted the configuration store to MongoDB using IdentityServer4.Contrib.MongoDB
https://github.com/diogodamiani/IdentityServer4.Contrib.MongoDB
This step works and everything goes fine.

Then, I converted the user store and role store to MongoDB.
My first attempt is alextochetto/aspnetcore-identity-mongodb
https://github.com/alextochetto/aspnetcore-identity-mongodb
The data migration is done and the angular client can log on successfully but the method of GetProfileDataAsync of my CustomProfileService is not called and I missed the role and custom claims.
The ServiceCollection was registered correctly IProfileService => CustomProfileService and confirmed with unit test.

Then I start everything all over again using
AspNetCore.Identity.MongoDbCore
https://www.nuget.org/packages/AspNetCore.Identity.MongoDbCore/

The same problem persists.
All three pieces IdentityServer, IdentityStore, ConfigurationStore worked separately with the only problem GetProfileDataAsync not being called.

My client is an angular client using oidc and implicit flow
client_id: 'spa',
scope: 'openid profile api',
response_type: 'id_token token',
filterProtocolClaims: true,
loadUserInfo: true,

Do you know any reference implementation that I can learn from ?
Thanks a lot.

question

Most helpful comment

Thanks a lot. Finally, I found that I have to rearrange the service collection registration order and make the IProfileService,CustomProfileService last to make the solution work.

All 4 comments

Do you know any reference implementation that I can learn from ?

No, sorry. Maybe someone else does...

Thanks a lot. Finally, I found that I have to rearrange the service collection registration order and make the IProfileService,CustomProfileService last to make the solution work.

@paulyipkh Great job, do you mind sharing your working solution on GitHub ?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

user1336 picture user1336  路  3Comments

osmankibar picture osmankibar  路  3Comments

garymacpherson picture garymacpherson  路  3Comments

leastprivilege picture leastprivilege  路  3Comments

cixonline picture cixonline  路  3Comments