-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b339ed9
commit 0f56291
Showing
6 changed files
with
50 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Gunnsoft.IdentityServer.Stores.MongoDB/BsonClassMapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Gunnsoft.IdentityServer.Stores.MongoDB.Collections.Clients; | ||
using Gunnsoft.IdentityServer.Stores.MongoDB.Collections.PersistedGrants; | ||
using MongoDB.Bson.Serialization; | ||
|
||
namespace Gunnsoft.IdentityServer.Stores.MongoDB | ||
{ | ||
public static class BsonClassMapper | ||
{ | ||
public static void MapClient() | ||
{ | ||
if (!BsonClassMap.IsClassMapRegistered(typeof(Client))) | ||
{ | ||
BsonClassMap.RegisterClassMap<Client>(cm => | ||
{ | ||
cm.AutoMap(); | ||
cm.MapIdMember(c => c.Id); | ||
cm.SetIgnoreExtraElements(true); | ||
}); | ||
} | ||
} | ||
|
||
public static void MapPeristedGrant() | ||
{ | ||
if (!BsonClassMap.IsClassMapRegistered(typeof(PersistedGrant))) | ||
{ | ||
BsonClassMap.RegisterClassMap<PersistedGrant>(cm => | ||
{ | ||
cm.AutoMap(); | ||
cm.MapIdMember(c => c.Id); | ||
cm.SetIgnoreExtraElements(true); | ||
}); | ||
} | ||
} | ||
} | ||
} |
9 changes: 3 additions & 6 deletions
9
src/Gunnsoft.IdentityServer.Stores.MongoDB/CollectionNames.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
namespace Gunnsoft.IdentityServer.Stores.MongoDB | ||
{ | ||
public static partial class IdentityServerBuilderExtensions | ||
public static class CollectionNames | ||
{ | ||
public static class CollectionNames | ||
{ | ||
public const string Clients = "clients"; | ||
public const string PersistedGrants = "persistedGrants"; | ||
} | ||
public const string Clients = "clients"; | ||
public const string PersistedGrants = "persistedGrants"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters