Configuration and settings
+Configuration
OpenIddict 3.0 comes with sensible defaults, but depending on the scenarios, the default settings can be amended to change how OpenIddict reacts to requests.
From d5d078a8e576bf59f81a04d027049d06d6a7d52e Mon Sep 17 00:00:00 2001 From: OpenIddict Bot <32257313+openiddict-bot@users.noreply.github.com> Date: Tue, 11 Jan 2022 16:30:01 +0000 Subject: [PATCH] Update the documentation pages --- .../encryption-and-signing-credentials.html | 10 +- configuration/index.html | 6 +- configuration/toc.html | 4 - .../choosing-the-right-flow.html | 0 .../authorization-code-flow.png | Bin .../client-credentials-flow.png | Bin .../choosing-the-right-flow/consent-form.png | Bin .../choosing-the-right-flow/implicit-flow.png | Bin .../resource-owner-password-flow.png | Bin {guide => guides}/getting-started.html | 32 +-- {guide => guides}/index.html | 0 {guide => guides}/migration/20-to-30.html | 0 {guide => guides}/toc.html | 0 index.html | 4 +- integrations/entity-framework-core.html | 223 ++++++++++++++++++ integrations/index.html | 120 ++++++++++ .../mongodb.html | 55 ++++- integrations/toc.html | 24 ++ manifest.json | 120 ++++++---- toc.html | 12 +- 20 files changed, 522 insertions(+), 88 deletions(-) rename {guide => guides}/choosing-the-right-flow.html (100%) rename {guide => guides}/choosing-the-right-flow/authorization-code-flow.png (100%) rename {guide => guides}/choosing-the-right-flow/client-credentials-flow.png (100%) rename {guide => guides}/choosing-the-right-flow/consent-form.png (100%) rename {guide => guides}/choosing-the-right-flow/implicit-flow.png (100%) rename {guide => guides}/choosing-the-right-flow/resource-owner-password-flow.png (100%) rename {guide => guides}/getting-started.html (89%) rename {guide => guides}/index.html (100%) rename {guide => guides}/migration/20-to-30.html (100%) rename {guide => guides}/toc.html (100%) create mode 100644 integrations/entity-framework-core.html create mode 100644 integrations/index.html rename configuration/mongodb-integration.html => integrations/mongodb.html (80%) create mode 100644 integrations/toc.html diff --git a/configuration/encryption-and-signing-credentials.html b/configuration/encryption-and-signing-credentials.html index daf6b9b..a353727 100644 --- a/configuration/encryption-and-signing-credentials.html +++ b/configuration/encryption-and-signing-credentials.html @@ -98,8 +98,8 @@
Tokens generated using the opt-in ASP.NET Core Data Protection integration rely on their own key ring, distinct from the credentials discussed in this documentation. -For more information about Data Protection, visit ASP.NET Core Data Protection.
+Tokens generated using the opt-in ASP.NET Core Data Protection integration rely on their own key ring, distinct from the credentials discussed in this documentation.
+For more information about Data Protection, visit ASP.NET Core Data Protection.
OpenIddict allows registering one or multiple keys (raw keys or embedded in X.509 certificates).
@@ -120,8 +120,8 @@ are not used by OpenIddict and certificates with the furthest expiration date ar .AddEphemeralSigningKey(); });options.AddEphemeralEncryptionKey()
generates an asymmetric RSA key which is not directly used as-is to encrypt the tokens but is used to encrypt an
-intermediate per-token symmetric key with which the token content is first encrypted using AES.
-For more information about this mechanism, read Key Encryption with RSAES OAEP.
For more information about this mechanism, read Key Encryption with RSAES OAEP.
For development purposes, a certificate can be generated and stored by OpenIddict in the certificates store of the user account running the OpenIddict server feature. @@ -176,7 +176,7 @@ var data = certificate.Export(X509ContentType.Pfx, string.Empty);
WEBSITE_LOAD_CERTIFICATES
flag.
-For more information, visit https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-certificate-in-codeoptions.UseLocalServer()
integrationOpenIddict 3.0 comes with sensible defaults, but depending on the scenarios, the default settings can be amended to change how OpenIddict reacts to requests.
Update your Entity Framework Core context registration to register the OpenIddict entities:
services.AddDbContext<ApplicationDbContext>(options =>
{
- // Configure the context to use Microsoft SQL Server.
+ // Configure Entity Framework Core to use Microsoft SQL Server.
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
// Register the entity sets needed by OpenIddict.
- // Note: use the generic overload if you need
- // to replace the default OpenIddict entities.
+ // Note: use the generic overload if you need to replace the default OpenIddict entities.
options.UseOpenIddict();
});
-
If you change the default entity primary key (e.g. to int
or Guid
instead of string
), make sure you use the options.ReplaceDefaultEntities<TKey>()
-core extension accepting a TKey
generic argument and use the generic options.UseOpenIddict<TKey>()
overload to configure EF Core to use the specified type:
services.AddOpenIddict()
- .AddCore(options =>
- {
- // Configure OpenIddict to use the default entities with a custom key type.
- options.UseEntityFrameworkCore()
- .UseDbContext<ApplicationDbContext>()
- .ReplaceDefaultEntities<Guid>();
- });
-
-services.AddDbContext<ApplicationDbContext>(options =>
-{
- // Configure the context to use Microsoft SQL Server.
- options.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"]);
-
- options.UseOpenIddict<Guid>();
-});
-
By default, the OpenIddict Entity Framework Core integration uses string
as the default type for primary keys.
+To use a different type, read Entity Framework Core integration : Use a custom primary key type.
Create your own authorization controller: Implementing a custom authorization controller is required to allow OpenIddict to create tokens based on the identities and claims you provide. diff --git a/guide/index.html b/guides/index.html similarity index 100% rename from guide/index.html rename to guides/index.html diff --git a/guide/migration/20-to-30.html b/guides/migration/20-to-30.html similarity index 100% rename from guide/migration/20-to-30.html rename to guides/migration/20-to-30.html diff --git a/guide/toc.html b/guides/toc.html similarity index 100% rename from guide/toc.html rename to guides/toc.html diff --git a/index.html b/index.html index 9385834..823bd1a 100644 --- a/index.html +++ b/index.html @@ -99,7 +99,7 @@
To configure OpenIddict to use MongoDB as the database for applications, authorizations, scopes and tokens, you'll need to:
Reference the OpenIddict.MongoDb
package:
For applications that require storing additional data alongside the properties used by OpenIddict, custom entities can be used. For that, you need to:
+Create custom entities:
+public class CustomApplication : OpenIddictMongoDbApplication
+{
+ public string CustomProperty { get; set; }
+}
+
+public class CustomAuthorization : OpenIddictMongoDbAuthorization
+{
+ public string CustomProperty { get; set; }
+}
+
+public class CustomScope : OpenIddictMongoDbScope
+{
+ public string CustomProperty { get; set; }
+}
+
+public class CustomToken : OpenIddictMongoDbToken
+{
+ public string CustomProperty { get; set; }
+}
+
Configure MongoDb to use the custom entities:
+services.AddOpenIddict()
+ .AddCore(options =>
+ {
+ options.UseMongoDb()
+ .ReplaceDefaultApplicationEntity<CustomApplication>()
+ .ReplaceDefaultAuthorizationEntity<CustomAuthorization>()
+ .ReplaceDefaultScopeEntity<CustomScope>()
+ .ReplaceDefaultTokenEntity<CustomToken>();
+ });
+
By default, OpenIddict uses the openiddict.[entity name]s
pattern to determine the default collection names.
+Applications that require using different collection names can use the Set*CollectionName()
helpers:
services.AddOpenIddict()
+ .AddCore(options =>
+ {
+ options.UseMongoDb()
+ .SetApplicationsCollectionName("custom-applications-collection")
+ .SetAuthorizationsCollectionName("custom-authorizations-collection")
+ .SetScopesCollectionName("custom-scopes-collection")
+ .SetTokensCollectionName("custom-tokens-collection");
+ });
+