mirror of
https://gitee.com/dcren/openiddict-documentation.git
synced 2025-09-20 18:47:54 +08:00
Update the documentation pages
This commit is contained in:
@@ -96,11 +96,13 @@ var services = new ServiceCollection();
|
|||||||
services.AddOpenIddict()
|
services.AddOpenIddict()
|
||||||
.AddCore(options => options.UseMongoDb());
|
.AddCore(options => options.UseMongoDb());
|
||||||
|
|
||||||
services.AddSingleton(new MongoClient("mongodb://localhost:27017").GetDatabase("openiddict"));
|
services.AddSingleton(new MongoClient(
|
||||||
|
"mongodb://localhost:27017").GetDatabase("openiddict"));
|
||||||
|
|
||||||
var provider = services.BuildServiceProvider();
|
var provider = services.BuildServiceProvider();
|
||||||
var context = provider.GetRequiredService<IOpenIddictMongoDbContext>();
|
var context = provider.GetRequiredService<IOpenIddictMongoDbContext>();
|
||||||
var options = provider.GetRequiredService<IOptionsMonitor<OpenIddictMongoDbOptions>>().CurrentValue;
|
var options = provider.GetRequiredService<
|
||||||
|
IOptionsMonitor<OpenIddictMongoDbOptions>>().CurrentValue;
|
||||||
var database = await context.GetDatabaseAsync(CancellationToken.None);
|
var database = await context.GetDatabaseAsync(CancellationToken.None);
|
||||||
|
|
||||||
var applications = database.GetCollection<OpenIddictMongoDbApplication>(
|
var applications = database.GetCollection<OpenIddictMongoDbApplication>(
|
||||||
@@ -136,7 +138,8 @@ await applications.Indexes.CreateManyAsync(new[]
|
|||||||
var authorizations = database.GetCollection<OpenIddictMongoDbAuthorization>(
|
var authorizations = database.GetCollection<OpenIddictMongoDbAuthorization>(
|
||||||
options.AuthorizationsCollectionName);
|
options.AuthorizationsCollectionName);
|
||||||
|
|
||||||
await authorizations.Indexes.CreateOneAsync(new CreateIndexModel<OpenIddictMongoDbAuthorization>(
|
await authorizations.Indexes.CreateOneAsync(
|
||||||
|
new CreateIndexModel<OpenIddictMongoDbAuthorization>(
|
||||||
Builders<OpenIddictMongoDbAuthorization>.IndexKeys
|
Builders<OpenIddictMongoDbAuthorization>.IndexKeys
|
||||||
.Ascending(authorization => authorization.ApplicationId)
|
.Ascending(authorization => authorization.ApplicationId)
|
||||||
.Ascending(authorization => authorization.Scopes)
|
.Ascending(authorization => authorization.Scopes)
|
||||||
@@ -164,13 +167,15 @@ var tokens = database.GetCollection<OpenIddictMongoDbToken>(
|
|||||||
await tokens.Indexes.CreateManyAsync(new[]
|
await tokens.Indexes.CreateManyAsync(new[]
|
||||||
{
|
{
|
||||||
new CreateIndexModel<OpenIddictMongoDbToken>(
|
new CreateIndexModel<OpenIddictMongoDbToken>(
|
||||||
Builders<OpenIddictMongoDbToken>.IndexKeys.Ascending(token => token.ReferenceId),
|
Builders<OpenIddictMongoDbToken>.IndexKeys.Ascending(
|
||||||
|
token => token.ReferenceId),
|
||||||
new CreateIndexOptions<OpenIddictMongoDbToken>
|
new CreateIndexOptions<OpenIddictMongoDbToken>
|
||||||
{
|
{
|
||||||
// Note: partial filter expressions are not supported on Azure Cosmos DB.
|
// Note: partial filter expressions are not supported on Azure Cosmos DB.
|
||||||
// As a workaround, the expression and the unique constraint can be removed.
|
// As a workaround, the expression and the unique constraint can be removed.
|
||||||
PartialFilterExpression =
|
PartialFilterExpression =
|
||||||
Builders<OpenIddictMongoDbToken>.Filter.Exists(token => token.ReferenceId),
|
Builders<OpenIddictMongoDbToken>.Filter.Exists(
|
||||||
|
token => token.ReferenceId),
|
||||||
Unique = true
|
Unique = true
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@@ -5661,7 +5661,7 @@
|
|||||||
"output": {
|
"output": {
|
||||||
".html": {
|
".html": {
|
||||||
"relative_path": "configuration/mongodb-integration.html",
|
"relative_path": "configuration/mongodb-integration.html",
|
||||||
"hash": "OBbgaaZ+b0E3MY4vEl7/kw=="
|
"hash": "za1L8HGicVtf0iDEj8PMvw=="
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is_incremental": false,
|
"is_incremental": false,
|
||||||
|
Reference in New Issue
Block a user