Update the documentation pages
@ -98,8 +98,8 @@
|
||||
<li><strong>Signing credentials are used to protect against tampering</strong>. They can be either asymmetric (e.g a RSA or ECDSA key) or symmetric.</li>
|
||||
<li><strong>Encryption credentials are used to ensure the content of tokens cannot be read by malicious parties</strong>. They can be either asymmetric (e.g a RSA key) or symmetric.</li>
|
||||
</ul>
|
||||
<div class="NOTE"><h5>Note</h5><p>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 <a href="https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/introduction">ASP.NET Core Data Protection</a>.</p>
|
||||
<div class="NOTE"><h5>Note</h5><p>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.</p>
|
||||
<p>For more information about Data Protection, visit <a href="https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/introduction">ASP.NET Core Data Protection</a>.</p>
|
||||
</div>
|
||||
<h2 id="registering-credentials-in-the-authorization-server-options">Registering credentials in the authorization server options</h2>
|
||||
<p>OpenIddict allows registering one or multiple keys (raw keys or embedded in X.509 certificates).</p>
|
||||
@ -120,8 +120,8 @@ are not used by OpenIddict and certificates with the furthest expiration date ar
|
||||
.AddEphemeralSigningKey();
|
||||
});
|
||||
</code></pre><div class="NOTE"><h5>Note</h5><p><code>options.AddEphemeralEncryptionKey()</code> generates an asymmetric RSA key which is not directly used as-is to encrypt the tokens but is used to encrypt an
|
||||
intermediate <em>per-token</em> symmetric key with which the token content is first encrypted using <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-5.2.6">AES</a>.
|
||||
For more information about this mechanism, read <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.3">Key Encryption with RSAES OAEP</a>.</p>
|
||||
intermediate <em>per-token</em> symmetric key with which the token content is first encrypted using <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-5.2.6">AES</a>.</p>
|
||||
<p>For more information about this mechanism, read <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.3">Key Encryption with RSAES OAEP</a>.</p>
|
||||
</div>
|
||||
<h3 id="registering-a-development-certificate">Registering a development certificate</h3>
|
||||
<p>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);
|
||||
<ul>
|
||||
<li>For IIS applications, storing the certificates in the machine store is the recommended option.</li>
|
||||
<li>On Azure, certificates can be uploaded and exposed to Azure App Services applications using the special <code>WEBSITE_LOAD_CERTIFICATES</code> flag.
|
||||
For more information, visit <a href="https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-certificate-in-code">https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-certificate-in-code</a></li>
|
||||
For more information, visit <a href="https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-certificate-in-code">Use a TLS/SSL certificate in your code in Azure App Service</a>.</li>
|
||||
</ul>
|
||||
<h2 id="importing-credentials-in-the-apiresource-validation-options">Importing credentials in the API/resource validation options</h2>
|
||||
<h3 id="using-the-optionsuselocalserver-integration">Using the <code>options.UseLocalServer()</code> integration</h3>
|
||||
|
@ -6,9 +6,9 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Configuration and settings </title>
|
||||
<title>Configuration </title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="title" content="Configuration and settings ">
|
||||
<meta name="title" content="Configuration ">
|
||||
<meta name="generator" content="docfx 2.56.7.0">
|
||||
|
||||
<link rel="shortcut icon" href="../images/favicon.ico">
|
||||
@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<article class="content wrap" id="_content" data-uid="">
|
||||
<h1 id="configuration-and-settings">Configuration and settings</h1>
|
||||
<h1 id="configuration">Configuration</h1>
|
||||
|
||||
<p>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.</p>
|
||||
</article>
|
||||
|
@ -24,10 +24,6 @@
|
||||
<li>
|
||||
<a href="encryption-and-signing-credentials.html" class="sidebar-item" name="" title="Encryption and signing credentials">Encryption and signing credentials</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="mongodb-integration.html" class="sidebar-item" name="" title="MongoDB integration">MongoDB integration</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="proof-key-for-code-exchange.html" class="sidebar-item" name="" title="Proof Key for Code Exchange">Proof Key for Code Exchange</a>
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -113,12 +113,11 @@ Here's an example for the client credentials grant, used in machine-to-machi
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
@ -186,33 +185,16 @@ Here's an example for the client credentials grant, used in machine-to-machi
|
||||
<li><p><strong>Update your Entity Framework Core context registration to register the OpenIddict entities</strong>:</p>
|
||||
<pre><code class="lang-csharp">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();
|
||||
});
|
||||
</code></pre><div class="WARNING"><h5>Warning</h5><p>If you change the default entity primary key (e.g. to <code>int</code> or <code>Guid</code> instead of <code>string</code>), make sure you use the <code>options.ReplaceDefaultEntities<TKey>()</code>
|
||||
core extension accepting a <code>TKey</code> generic argument and use the generic <code>options.UseOpenIddict<TKey>()</code> overload to configure EF Core to use the specified type:</p>
|
||||
<pre><code class="lang-csharp">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>();
|
||||
});
|
||||
</code></pre></div>
|
||||
</code></pre><div class="NOTE"><h5>Note</h5><p>By default, the OpenIddict Entity Framework Core integration uses <code>string</code> as the default type for primary keys.
|
||||
To use a different type, read <a href="../integrations/entity-framework-core.html#use-a-custom-primary-key-type">Entity Framework Core integration : Use a custom primary key type</a>.</p>
|
||||
</div>
|
||||
</li>
|
||||
<li><p><strong>Create your own authorization controller:</strong>
|
||||
Implementing a custom authorization controller is required to allow OpenIddict to create tokens based on the identities and claims you provide.
|
@ -99,7 +99,7 @@
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default" style="min-height: 120px;">
|
||||
<div class="panel-body">
|
||||
<p><strong><a href="guide/index.html">Introduction</a></strong></p>
|
||||
<p><strong><a href="guides/index.html">Introduction</a></strong></p>
|
||||
<p>Read an introduction on OpenIddict and the reason it was created.</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -107,7 +107,7 @@
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default" style="min-height: 120px;">
|
||||
<div class="panel-body">
|
||||
<p><strong><a href="guide/getting-started.html">Getting started</a></strong></p>
|
||||
<p><strong><a href="guides/getting-started.html">Getting started</a></strong></p>
|
||||
<p>Get started quickly by working through this step-by-step guide.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
223
integrations/entity-framework-core.html
Normal file
@ -0,0 +1,223 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE]><![endif]-->
|
||||
<html>
|
||||
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Entity Framework Core integration </title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="title" content="Entity Framework Core integration ">
|
||||
<meta name="generator" content="docfx 2.56.7.0">
|
||||
|
||||
<link rel="shortcut icon" href="../images/favicon.ico">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/night-owl.min.css">
|
||||
<link rel="stylesheet" href="../styles/colors.css">
|
||||
<link rel="stylesheet" href="../styles/discord.css">
|
||||
<link rel="stylesheet" href="../styles/main.css">
|
||||
<meta property="docfx:navrel" content="../toc.html">
|
||||
<meta property="docfx:tocrel" content="toc.html">
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="top-navbar">
|
||||
|
||||
<a href="javascript:void(0);" class="burger-icon" onclick="toggleMenu()">
|
||||
<svg name="Hamburger" style="vertical-align: middle;" width="24" height="24" viewbox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M20 6H4V9H20V6ZM4 10.999H20V13.999H4V10.999ZM4 15.999H20V18.999H4V15.999Z"></path></svg>
|
||||
</a>
|
||||
|
||||
|
||||
<a class="brand" href="../index.html">
|
||||
<img src="../images/logo.png" alt="OpenIddict" class="logomark">
|
||||
<span class="brand-title">OpenIddict</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="body-content">
|
||||
|
||||
<div id="blackout" class="blackout" onclick="toggleMenu()"></div>
|
||||
|
||||
<nav id="sidebar" role="navigation">
|
||||
|
||||
<div class="sidebar">
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
<a class="brand" href="../index.html">
|
||||
<img src="../images/logo.png" alt="OpenIddict" class="logomark">
|
||||
<span class="brand-title">OpenIddict</span>
|
||||
</a>
|
||||
<div id="navbar">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="sidebar-item-separator"></div>
|
||||
|
||||
|
||||
<div id="sidetoggle">
|
||||
<div id="sidetoc"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<span>Generated by <strong>DocFX</strong></span>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="main-panel">
|
||||
|
||||
<div role="main" class="hide-when-search">
|
||||
|
||||
|
||||
<div class="subnav navbar navbar-default">
|
||||
<div class="container hide-when-search" id="breadcrumb">
|
||||
<ul class="breadcrumb">
|
||||
<li></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<article class="content wrap" id="_content" data-uid="">
|
||||
<h1 id="entity-framework-core-integration">Entity Framework Core integration</h1>
|
||||
|
||||
<h2 id="basic-configuration">Basic configuration</h2>
|
||||
<p>To configure OpenIddict to use Entity Framework Core as the database for applications, authorizations, scopes and tokens, you'll need to:</p>
|
||||
<ul>
|
||||
<li><p><strong>Reference the <code>OpenIddict.EntityFrameworkCore</code> package</strong>:</p>
|
||||
<pre><code class="lang-xml"><PackageReference Include="OpenIddict.EntityFrameworkCore" Version="3.1.1" />
|
||||
</code></pre></li>
|
||||
<li><p><strong>Create a database context deriving from <code>DbContext</code> (or <code>IdentityDbContext</code> when using ASP.NET Core Identity)</strong>:</p>
|
||||
<pre><code class="lang-csharp">public class ApplicationDbContext : DbContext
|
||||
{
|
||||
public ApplicationDbContext(DbContextOptions options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
}
|
||||
</code></pre></li>
|
||||
<li><p><strong>Configure OpenIddict to use the Entity Framework Core stores</strong>:</p>
|
||||
<pre><code class="lang-csharp">services.AddOpenIddict()
|
||||
.AddCore(options =>
|
||||
{
|
||||
options.UseEntityFrameworkCore()
|
||||
.UseDbContext<ApplicationDbContext>();
|
||||
});
|
||||
</code></pre></li>
|
||||
<li><p><strong>Configure Entity Framework Core to register the OpenIddict entities in the model</strong>:</p>
|
||||
<pre><code class="lang-csharp">services.AddDbContext<ApplicationDbContext>(options =>
|
||||
{
|
||||
// Configure the Entity Framework Core to use Microsoft SQL Server.
|
||||
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
// Register the entity sets needed by OpenIddict.
|
||||
options.UseOpenIddict();
|
||||
});
|
||||
</code></pre></li>
|
||||
<li><p><strong>Use migrations or recreate the database to add the OpenIddict entities</strong>.
|
||||
For more information, read <a href="https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/">Migrations Overview</a>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 id="advanced-configuration">Advanced configuration</h2>
|
||||
<h3 id="use-a-custom-primary-key-type">Use a custom primary key type</h3>
|
||||
<p>By default, the Entity Framework Core integration uses <code>string</code> primary keys, which matches the default key type used by ASP.NET Core Identity.</p>
|
||||
<p>To use a different key type (e.g <code>int</code>, <code>long</code> or <code>Guid</code>):</p>
|
||||
<ul>
|
||||
<li><p><strong>Call the generic <code>ReplaceDefaultEntities<TKey>()</code> method to force OpenIddict to use the default entities with the specified key type</strong>:</p>
|
||||
<pre><code class="lang-csharp">services.AddOpenIddict()
|
||||
.AddCore(options =>
|
||||
{
|
||||
// Configure OpenIddict to use the default entities with a custom key type.
|
||||
options.UseEntityFrameworkCore()
|
||||
.UseDbContext<ApplicationDbContext>()
|
||||
.ReplaceDefaultEntities<Guid>();
|
||||
});
|
||||
</code></pre></li>
|
||||
<li><p><strong>Configure Entity Framework Core to include the default entities with the chosen key type in the model</strong>:</p>
|
||||
<pre><code class="lang-csharp">services.AddDbContext<ApplicationDbContext>(options =>
|
||||
{
|
||||
// Configure Entity Framework Core to use Microsoft SQL Server.
|
||||
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
// Register the entity sets needed by OpenIddict but use a custom key type.
|
||||
options.UseOpenIddict<Guid>();
|
||||
});
|
||||
</code></pre></li>
|
||||
</ul>
|
||||
<h3 id="use-custom-entities">Use custom entities</h3>
|
||||
<p>For applications that require storing additional data alongside the properties used by OpenIddict, custom entities can be used. For that, you need to:</p>
|
||||
<ul>
|
||||
<li><p><strong>Create custom entities</strong>:</p>
|
||||
<pre><code class="lang-csharp">public class CustomApplication : OpenIddictEntityFrameworkCoreApplication<long, CustomAuthorization, CustomToken>
|
||||
{
|
||||
public string CustomProperty { get; set; }
|
||||
}
|
||||
|
||||
public class CustomAuthorization : OpenIddictEntityFrameworkCoreAuthorization<long, CustomApplication, CustomToken>
|
||||
{
|
||||
public string CustomProperty { get; set; }
|
||||
}
|
||||
|
||||
public class CustomScope : OpenIddictEntityFrameworkCoreScope<long>
|
||||
{
|
||||
public string CustomProperty { get; set; }
|
||||
}
|
||||
|
||||
public class CustomToken : OpenIddictEntityFrameworkCoreToken<long, CustomApplication, CustomAuthorization>
|
||||
{
|
||||
public string CustomProperty { get; set; }
|
||||
}
|
||||
</code></pre></li>
|
||||
<li><p><strong>Call the generic <code>ReplaceDefaultEntities<TApplication, TAuthorization, TScope, TToken, TKey>()</code> method to force OpenIddict to use the custom entities</strong>:</p>
|
||||
<pre><code class="lang-csharp">services.AddOpenIddict()
|
||||
.AddCore(options =>
|
||||
{
|
||||
// Configure OpenIddict to use the custom entities.
|
||||
options.UseEntityFrameworkCore()
|
||||
.UseDbContext<ApplicationDbContext>()
|
||||
.ReplaceDefaultEntities<CustomApplication, CustomAuthorization, CustomScope, CustomToken, long>();
|
||||
});
|
||||
</code></pre></li>
|
||||
<li><p><strong>Configure Entity Framework Core to include the custom entities in the model</strong>:</p>
|
||||
<pre><code class="lang-csharp">services.AddDbContext<ApplicationDbContext>(options =>
|
||||
{
|
||||
// Configure Entity Framework Core to use Microsoft SQL Server.
|
||||
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
// Register the entity sets needed by OpenIddict but use the specified entities instead of the default ones.
|
||||
options.UseOpenIddict<CustomApplication, CustomAuthorization, CustomScope, CustomToken, long>();
|
||||
});
|
||||
</code></pre></li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../styles/jquery.twbsPagination.js"></script>
|
||||
<script type="text/javascript" src="../styles/url.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
|
||||
<script type="text/javascript" src="../styles/docfx.js"></script>
|
||||
<script type="text/javascript" src="../styles/main.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
120
integrations/index.html
Normal file
@ -0,0 +1,120 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE]><![endif]-->
|
||||
<html>
|
||||
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Integrations </title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="title" content="Integrations ">
|
||||
<meta name="generator" content="docfx 2.56.7.0">
|
||||
|
||||
<link rel="shortcut icon" href="../images/favicon.ico">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/night-owl.min.css">
|
||||
<link rel="stylesheet" href="../styles/colors.css">
|
||||
<link rel="stylesheet" href="../styles/discord.css">
|
||||
<link rel="stylesheet" href="../styles/main.css">
|
||||
<meta property="docfx:navrel" content="../toc.html">
|
||||
<meta property="docfx:tocrel" content="toc.html">
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="top-navbar">
|
||||
|
||||
<a href="javascript:void(0);" class="burger-icon" onclick="toggleMenu()">
|
||||
<svg name="Hamburger" style="vertical-align: middle;" width="24" height="24" viewbox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M20 6H4V9H20V6ZM4 10.999H20V13.999H4V10.999ZM4 15.999H20V18.999H4V15.999Z"></path></svg>
|
||||
</a>
|
||||
|
||||
|
||||
<a class="brand" href="../index.html">
|
||||
<img src="../images/logo.png" alt="OpenIddict" class="logomark">
|
||||
<span class="brand-title">OpenIddict</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="body-content">
|
||||
|
||||
<div id="blackout" class="blackout" onclick="toggleMenu()"></div>
|
||||
|
||||
<nav id="sidebar" role="navigation">
|
||||
|
||||
<div class="sidebar">
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
<a class="brand" href="../index.html">
|
||||
<img src="../images/logo.png" alt="OpenIddict" class="logomark">
|
||||
<span class="brand-title">OpenIddict</span>
|
||||
</a>
|
||||
<div id="navbar">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="sidebar-item-separator"></div>
|
||||
|
||||
|
||||
<div id="sidetoggle">
|
||||
<div id="sidetoc"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<span>Generated by <strong>DocFX</strong></span>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="main-panel">
|
||||
|
||||
<div role="main" class="hide-when-search">
|
||||
|
||||
|
||||
<div class="subnav navbar navbar-default">
|
||||
<div class="container hide-when-search" id="breadcrumb">
|
||||
<ul class="breadcrumb">
|
||||
<li></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<article class="content wrap" id="_content" data-uid="">
|
||||
<h1 id="integrations">Integrations</h1>
|
||||
|
||||
<p>OpenIddict offers native integrations with popular Object–relational Mapping tools and Database Clients like Entity Framework 6 and Entity Framework Core or MongoDB.</p>
|
||||
<p>Documentation for integrations maintained by the OpenIddict community can be found in their respective repositories:</p>
|
||||
<ul>
|
||||
<li><strong><a href="https://github.com/panoukos41/couchdb-openiddict">P41.OpenIddict.CouchDB</a></strong> by <a href="https://github.com/panoukos41">Panos Athanasiou</a>: CouchDB stores for OpenIddict.</li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../styles/jquery.twbsPagination.js"></script>
|
||||
<script type="text/javascript" src="../styles/url.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
|
||||
<script type="text/javascript" src="../styles/docfx.js"></script>
|
||||
<script type="text/javascript" src="../styles/main.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -93,6 +93,7 @@
|
||||
<article class="content wrap" id="_content" data-uid="">
|
||||
<h1 id="mongodb-integration">MongoDB integration</h1>
|
||||
|
||||
<h2 id="basic-configuration">Basic configuration</h2>
|
||||
<p>To configure OpenIddict to use MongoDB as the database for applications, authorizations, scopes and tokens, you'll need to:</p>
|
||||
<ul>
|
||||
<li><p><strong>Reference the <code>OpenIddict.MongoDb</code> package</strong>:</p>
|
||||
@ -198,8 +199,7 @@ await tokens.Indexes.CreateManyAsync(new[]
|
||||
{
|
||||
// Note: partial filter expressions are not supported on Azure Cosmos DB.
|
||||
// As a workaround, the expression and the unique constraint can be removed.
|
||||
PartialFilterExpression =
|
||||
Builders<OpenIddictMongoDbToken>.Filter.Exists(token => token.ReferenceId),
|
||||
PartialFilterExpression = Builders<OpenIddictMongoDbToken>.Filter.Exists(token => token.ReferenceId),
|
||||
Unique = true
|
||||
}),
|
||||
|
||||
@ -216,7 +216,56 @@ await tokens.Indexes.CreateManyAsync(new[]
|
||||
});
|
||||
</code></pre></li>
|
||||
</ul>
|
||||
</article>
|
||||
<h2 id="advanced-configuration">Advanced configuration</h2>
|
||||
<h3 id="use-custom-entities">Use custom entities</h3>
|
||||
<p>For applications that require storing additional data alongside the properties used by OpenIddict, custom entities can be used. For that, you need to:</p>
|
||||
<ul>
|
||||
<li><p><strong>Create custom entities</strong>:</p>
|
||||
<pre><code class="lang-csharp">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; }
|
||||
}
|
||||
</code></pre></li>
|
||||
<li><p><strong>Configure MongoDb to use the custom entities</strong>:</p>
|
||||
<pre><code class="lang-csharp">services.AddOpenIddict()
|
||||
.AddCore(options =>
|
||||
{
|
||||
options.UseMongoDb()
|
||||
.ReplaceDefaultApplicationEntity<CustomApplication>()
|
||||
.ReplaceDefaultAuthorizationEntity<CustomAuthorization>()
|
||||
.ReplaceDefaultScopeEntity<CustomScope>()
|
||||
.ReplaceDefaultTokenEntity<CustomToken>();
|
||||
});
|
||||
</code></pre></li>
|
||||
</ul>
|
||||
<h3 id="use-custom-collection-names">Use custom collection names</h3>
|
||||
<p>By default, OpenIddict uses the <code>openiddict.[entity name]s</code> pattern to determine the default collection names.
|
||||
Applications that require using different collection names can use the <code>Set*CollectionName()</code> helpers:</p>
|
||||
<pre><code class="lang-csharp">services.AddOpenIddict()
|
||||
.AddCore(options =>
|
||||
{
|
||||
options.UseMongoDb()
|
||||
.SetApplicationsCollectionName("custom-applications-collection")
|
||||
.SetAuthorizationsCollectionName("custom-authorizations-collection")
|
||||
.SetScopesCollectionName("custom-scopes-collection")
|
||||
.SetTokensCollectionName("custom-tokens-collection");
|
||||
});
|
||||
</code></pre></article>
|
||||
|
||||
</div>
|
||||
</main>
|
24
integrations/toc.html
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
<div id="sidetoggle">
|
||||
<div>
|
||||
<div class="sidetoc">
|
||||
<div class="toc" id="toc">
|
||||
|
||||
<ul class="nav level1">
|
||||
<li>
|
||||
<a href="index.html" class="sidebar-item" name="" title="Introduction">Introduction</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="entity-framework-core.html" class="sidebar-item" name="" title="Entity Framework Core">Entity Framework Core</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="mongodb.html" class="sidebar-item" name="" title="MongoDB">MongoDB</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
120
manifest.json
@ -45,7 +45,7 @@
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "configuration/encryption-and-signing-credentials.html",
|
||||
"hash": "X9XDnZLKY/5K8DpDgTMVvg=="
|
||||
"hash": "BNTD2XpB9JvFGvWlIh4bwg=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -57,19 +57,7 @@
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "configuration/index.html",
|
||||
"hash": "k22iYcCNt9Gl/NHlrXpepA=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
"version": ""
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "configuration/mongodb-integration.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "configuration/mongodb-integration.html",
|
||||
"hash": "72Lugm/G2OOW9NWHWLB3aA=="
|
||||
"hash": "AICKK9g02yD4LxurxlIMoA=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -93,7 +81,7 @@
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "configuration/toc.html",
|
||||
"hash": "MHZ474LlHgfAYPcHgjObAA=="
|
||||
"hash": "GUTCYQ1PRD0hdbfXZoXI/w=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1541,11 +1529,11 @@
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "guide/choosing-the-right-flow.md",
|
||||
"source_relative_path": "guides/choosing-the-right-flow.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "guide/choosing-the-right-flow.html",
|
||||
"hash": "gWAtbPR4n11oTgPNGVzu+g=="
|
||||
"relative_path": "guides/choosing-the-right-flow.html",
|
||||
"hash": "wcSamfwfNmeDNib8wiVnTQ=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1553,10 +1541,10 @@
|
||||
},
|
||||
{
|
||||
"type": "Resource",
|
||||
"source_relative_path": "guide/choosing-the-right-flow/authorization-code-flow.png",
|
||||
"source_relative_path": "guides/choosing-the-right-flow/authorization-code-flow.png",
|
||||
"output": {
|
||||
"resource": {
|
||||
"relative_path": "guide/choosing-the-right-flow/authorization-code-flow.png"
|
||||
"relative_path": "guides/choosing-the-right-flow/authorization-code-flow.png"
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1564,10 +1552,10 @@
|
||||
},
|
||||
{
|
||||
"type": "Resource",
|
||||
"source_relative_path": "guide/choosing-the-right-flow/client-credentials-flow.png",
|
||||
"source_relative_path": "guides/choosing-the-right-flow/client-credentials-flow.png",
|
||||
"output": {
|
||||
"resource": {
|
||||
"relative_path": "guide/choosing-the-right-flow/client-credentials-flow.png"
|
||||
"relative_path": "guides/choosing-the-right-flow/client-credentials-flow.png"
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1575,10 +1563,10 @@
|
||||
},
|
||||
{
|
||||
"type": "Resource",
|
||||
"source_relative_path": "guide/choosing-the-right-flow/consent-form.png",
|
||||
"source_relative_path": "guides/choosing-the-right-flow/consent-form.png",
|
||||
"output": {
|
||||
"resource": {
|
||||
"relative_path": "guide/choosing-the-right-flow/consent-form.png"
|
||||
"relative_path": "guides/choosing-the-right-flow/consent-form.png"
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1586,10 +1574,10 @@
|
||||
},
|
||||
{
|
||||
"type": "Resource",
|
||||
"source_relative_path": "guide/choosing-the-right-flow/implicit-flow.png",
|
||||
"source_relative_path": "guides/choosing-the-right-flow/implicit-flow.png",
|
||||
"output": {
|
||||
"resource": {
|
||||
"relative_path": "guide/choosing-the-right-flow/implicit-flow.png"
|
||||
"relative_path": "guides/choosing-the-right-flow/implicit-flow.png"
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1597,10 +1585,10 @@
|
||||
},
|
||||
{
|
||||
"type": "Resource",
|
||||
"source_relative_path": "guide/choosing-the-right-flow/resource-owner-password-flow.png",
|
||||
"source_relative_path": "guides/choosing-the-right-flow/resource-owner-password-flow.png",
|
||||
"output": {
|
||||
"resource": {
|
||||
"relative_path": "guide/choosing-the-right-flow/resource-owner-password-flow.png"
|
||||
"relative_path": "guides/choosing-the-right-flow/resource-owner-password-flow.png"
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1608,11 +1596,11 @@
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "guide/getting-started.md",
|
||||
"source_relative_path": "guides/getting-started.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "guide/getting-started.html",
|
||||
"hash": "XR2F+SYNqKQbYnQTQ1lAVQ=="
|
||||
"relative_path": "guides/getting-started.html",
|
||||
"hash": "w4ot0irGPo6kPbJCtXT9sQ=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1620,11 +1608,11 @@
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "guide/index.md",
|
||||
"source_relative_path": "guides/index.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "guide/index.html",
|
||||
"hash": "1WppPUd3tc49Q1IuN6MpfA=="
|
||||
"relative_path": "guides/index.html",
|
||||
"hash": "GYPiSn0I/fhjecInWBd+sA=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1632,11 +1620,11 @@
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "guide/migration/20-to-30.md",
|
||||
"source_relative_path": "guides/migration/20-to-30.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "guide/migration/20-to-30.html",
|
||||
"hash": "gXjJnqMDORzKmvYY4OLRSA=="
|
||||
"relative_path": "guides/migration/20-to-30.html",
|
||||
"hash": "tvhWtNPbpiYeQ0xcP1I4oQ=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -1644,10 +1632,10 @@
|
||||
},
|
||||
{
|
||||
"type": "Toc",
|
||||
"source_relative_path": "guide/toc.yml",
|
||||
"source_relative_path": "guides/toc.yml",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "guide/toc.html",
|
||||
"relative_path": "guides/toc.html",
|
||||
"hash": "Q2Rq3xUOIstDdNnNV/CmBA=="
|
||||
}
|
||||
},
|
||||
@ -1682,7 +1670,55 @@
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "index.html",
|
||||
"hash": "3nPaLmwJHUE2QAgJqejTcw=="
|
||||
"hash": "LDX2KG1mNaZgnySmcrJkYQ=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
"version": ""
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "integrations/entity-framework-core.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "integrations/entity-framework-core.html",
|
||||
"hash": "/+6V48DwOyGcYnlBTNI0og=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
"version": ""
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "integrations/index.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "integrations/index.html",
|
||||
"hash": "WDTvL+SrcS/LrtG9czbidA=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
"version": ""
|
||||
},
|
||||
{
|
||||
"type": "Conceptual",
|
||||
"source_relative_path": "integrations/mongodb.md",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "integrations/mongodb.html",
|
||||
"hash": "4vhlfSOVT9PhnUD5B3NxfA=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
"version": ""
|
||||
},
|
||||
{
|
||||
"type": "Toc",
|
||||
"source_relative_path": "integrations/toc.yml",
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "integrations/toc.html",
|
||||
"hash": "914frhil++hv0x3ddB061A=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -2376,7 +2412,7 @@
|
||||
"output": {
|
||||
".html": {
|
||||
"relative_path": "toc.html",
|
||||
"hash": "6bYAB6WKrlIEFqIGMFlPbw=="
|
||||
"hash": "pkjNX/g9gq1U7BbZjUNK4w=="
|
||||
}
|
||||
},
|
||||
"is_incremental": false,
|
||||
@ -2397,7 +2433,7 @@
|
||||
"ConceptualDocumentProcessor": {
|
||||
"can_incremental": false,
|
||||
"incrementalPhase": "build",
|
||||
"total_file_count": 132,
|
||||
"total_file_count": 134,
|
||||
"skipped_file_count": 0
|
||||
},
|
||||
"ResourceDocumentProcessor": {
|
||||
|
12
toc.html
@ -6,19 +6,23 @@
|
||||
|
||||
<ul class="nav level1">
|
||||
<li>
|
||||
<a href="guide/index.html" class="sidebar-item" name="" title="User guides">User guides</a>
|
||||
<a href="guides/index.html" class="sidebar-item" name="guides/toc.html" title="User guides">User guides</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="configuration/index.html" class="sidebar-item" name="" title="Configuration and settings">Configuration and settings</a>
|
||||
<a href="configuration/index.html" class="sidebar-item" name="configuration/toc.html" title="Configuration">Configuration</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/openiddict/openiddict-samples" class="sidebar-item" name="" title="Samples">Samples</a>
|
||||
<a href="integrations/index.html" class="sidebar-item" name="integrations/toc.html" title="Integrations">Integrations</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/openiddict/openiddict-core/releases" class="sidebar-item" name="" title="Changelog">Changelog</a>
|
||||
<a href="https://github.com/openiddict/openiddict-samples" class="sidebar-item" name="" title="Samples (external)">Samples (external)</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/openiddict/openiddict-core/releases" class="sidebar-item" name="" title="Changelog (external)">Changelog (external)</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|